annotate lisp/textmodes/org.el @ 72273:3f5cb3f04fdc

"C-n doesn't work in Customize Option buffer in -nw with long value displayed" fix committed
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 04 Aug 2006 15:44:27 +0000
parents 4df24233cf1e
children 1c9c6dd0b6d3 8a8e69664178
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1 ;;; org.el --- Outline-based notes management and organize
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2 ;; Carstens outline-mode for keeping track of everything.
68648
067115a6e738 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 68480
diff changeset
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6 ;; Keywords: outlines, hypermedia, calendar, wp
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
8 ;; Version: 4.43
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
9 ;;
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
10 ;; This file is part of GNU Emacs.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11 ;;
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
20 ;; GNU General Public License for more details.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
65638
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65583
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65583
diff changeset
25 ;; Boston, MA 02110-1301, USA.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; project planning with a fast and effective plain-text system.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;;
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
33 ;; Org-mode develops organizational tasks around NOTES files that contain
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
34 ;; information about projects as plain text. Org-mode is implemented on
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
35 ;; top of outline-mode, which makes it possible to keep the content of
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
36 ;; large files well structured. Visibility cycling and structure editing
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
37 ;; help to work with the tree. Tables are easily created with a built-in
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
38 ;; table editor. Org-mode supports ToDo items, deadlines, time stamps,
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
39 ;; and scheduling. It dynamically compiles entries into an agenda that
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
40 ;; utilizes and smoothly integrates much of the Emacs calendar and diary.
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
41 ;; Plain text URL-like links connect to websites, emails, Usenet
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
42 ;; messages, BBDB entries, and any files related to the projects. For
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
43 ;; printing and sharing of notes, an Org-mode file can be exported as a
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
44 ;; structured ASCII file, as HTML, or (todo and agenda items only) as an
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
45 ;; iCalendar file. It can also serve as a publishing tool for a set of
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
46 ;; linked webpages.
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
47 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; Installation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; ------------
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
51 ;; If Org-mode is part of the Emacs distribution or an XEmacs package, you
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
52 ;; only need to copy the following lines to your .emacs file. The last two
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
53 ;; lines define *global* keys for the commands `org-store-link' and
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
54 ;; `org-agenda' - please choose suitable keys yourself.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;;
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
56 ;; (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
57 ;; (define-key global-map "\C-cl" 'org-store-link)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
58 ;; (define-key global-map "\C-ca" 'org-agenda)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
59 ;;
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
60 ;; Furthermore you need to activate font-lock-mode in org-mode buffers.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
61 ;; either of the following two lins will do the trick:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
62 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
63 ;; (global-font-lock-mode 1) ; for all buffers
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
64 ;; (add-hook 'org-mode-hook 'turn-on-font-lock) ; org-mode buffers only
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;;
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
66 ;; If you have downloaded Org-mode from the Web, you have to take additional
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
67 ;; action: Byte-compile org.el and org-publish.el and put them together with
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
68 ;; org-install.el on your load path. Then also add to your .emacs file:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
69 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
70 ;; (require 'org-install)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;;
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
72 ;;
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
73 ;; Activation
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
74 ;; ----------
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
75 ;; The setup above will put all files with extension ".org" into Org-mode.
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
76 ;; As an alternative, make the first line of a file look like this:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; MY PROJECTS -*- mode: org; -*-
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;; which will select Org-mode for this buffer no matter what the file's
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; name is.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;; Documentation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; -------------
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
85 ;; The documentation of Org-mode can be found in the TeXInfo file. The
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
86 ;; distribution also contains a PDF version of it. At the homepage of
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
87 ;; Org-mode, you can read the same text online as HTML. There is also an
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
88 ;; excellent reference card made by Philip Rooke. This card can be found
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
89 ;; in the etc/ directory of Emacs 22.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;;
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
91 ;; Recent changes
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
92 ;; --------------
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
93 ;; Version 4.43
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
94 ;; - Big fixes
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
95 ;;
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
96 ;; Version 4.42
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
97 ;; - Bug fixes
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
98 ;; - `s' key in the agenda saves all org-mode buffers.
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
99 ;;
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
100 ;; Version 4.41
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
101 ;; - Shift-curser keys can modify inactive time stamps (inactive time
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
102 ;; stamps are the ones in [...] brackets.
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
103 ;; - Toggle all checkboxes in a region/below a headline.
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
104 ;; - Bug fixes.
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
105 ;;
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
106 ;; Version 4.40
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
107 ;; - Bug fixes.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
108 ;;
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
109 ;; Version 4.39
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
110 ;; - Special tag ARCHIVE keeps a subtree closed and away from agenda lists.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
111 ;; - LaTeX code in Org-mode files can be converted to images for HTML.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
112 ;; - Bug fixes.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
113 ;; - CDLaTeX-mode features can be used in Org-mode to help inserting
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
114 ;; LaTeX environment and math.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
115 ;;
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
116 ;; Version 4.38
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
117 ;; - noutline.el is now required (important for XEmacs users only).
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
118 ;; - Dynamic blocks.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
119 ;; - Archiving of all level 1 trees without open TODO items.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
120 ;; - Clock reports can be inserted into the file in a special section.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
121 ;; - FAQ removed from the manual, now only on the web.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
122 ;; - Bug fixes.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
123 ;;
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
124 ;; Version 4.37
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
125 ;; - Clock-feature for measuring time spent on specific items.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
126 ;; - Improved emphasizing allows configuration and stacking.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
127 ;;
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
128 ;; Version 4.36
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
129 ;; - Improved indentation of ASCII export, when headlines become items.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
130 ;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
131 ;; and will not lead to conflicts.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
132 ;; - Support for mutually exclusive TAGS with the fast tags interface.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
133 ;; - Bug fixes.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
134 ;;
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
135 ;; Version 4.35
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
136 ;; - HTML export is now valid XHTML.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
137 ;; - Timeline can also show dates without entries. See new option
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
138 ;; `org-timeline-show-empty-dates'.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
139 ;; - The bullets created by the ASCII exporter can now be configured.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
140 ;; See the new option `org-export-ascii-bullets'.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
141 ;; - New face `org-upcoming-deadline' (was `org-scheduled-previously').
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
142 ;; - New function `org-context' to allow testing for local context.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
143 ;;
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
144 ;; Version 4.34
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
145 ;; - Bug fixes.
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
146 ;;
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
147 ;; Version 4.33
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
148 ;; - New commands to move through plain lists: S-up and S-down.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
149 ;; - Bug fixes and documentation update.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
150 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
151 ;; Version 4.32
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
152 ;; - Fast (single-key-per-tag) interface for setting TAGS.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
153 ;; - The list of legal tags can be configured globally and locally.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
154 ;; - Elisp and Info links (thanks to Todd Neal).
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
155 ;; - `org-export-publishing-directory' can be an alist, with different
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
156 ;; directories for different export types.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
157 ;; - All context-sensitive commands use `call-interactively' to dispatch.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
158 ;; - `org-confirm-shell-links' renamed to `org-confirm-shell-link-function'.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
159 ;; - Bug fixes.
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
160 ;;
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
161 ;; Version 4.31
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
162 ;; - Bug fixes.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
163 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
164 ;; Version 4.30
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
165 ;; - Modified installation: Autoloads have been collected in org-install.el.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
166 ;; - Logging (org-log-done) is now a #+STARTUP option.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
167 ;; - Checkboxes in plain list items, following up on Frank Ruell's idea.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
168 ;; - File links inserted with C-c C-l will use relative paths if the linked
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
169 ;; file is in the current directory or a subdirectory of it.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
170 ;; - New variable `org-link-file-path-type' to specify preference for
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
171 ;; relative and absolute paths.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
172 ;; - New CSS classes for tags, timestamps, timestamp keywords.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
173 ;; - Bug and typo fixes.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
174 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
175 ;; Version 4.29
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
176 ;; - Inlining images in HTML export now depends on wheather the link
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
177 ;; contains a description or not.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
178 ;; - TODO items can be scheduled from the global TODO list using C-c C-s.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
179 ;; - TODO items already scheduled can be made to disappear from the global
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
180 ;; todo list, see `org-agenda-todo-ignore-scheduled'.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
181 ;; - In Tables, formulas may also be Lisp forms.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
182 ;; - Exporting the visible part of an outline with `C-c C-x v' works now
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
183 ;; for all available exporters.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
184 ;; - Bug fixes, lots of them :-(
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
185 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
186 ;; Version 4.28
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
187 ;; - Bug fixes.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
188 ;;
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
189 ;; Version 4.27
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
190 ;; - HTML exporter generalized to receive external options.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
191 ;; As part of the process, author, email and date have been moved to the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
192 ;; end of the HTML file.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
193 ;; - Support for customizable file search in file links.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
194 ;; - BibTeX database links as first application of the above.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
195 ;; - New option `org-agenda-todo-list-sublevels' to turn off listing TODO
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
196 ;; entries that are sublevels of another TODO entry.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
197 ;;
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
198 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;;; Code:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
201 (eval-when-compile
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
202 (require 'cl)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
203 (require 'calendar))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
204 ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
205 ;; the file noutline.el being loaded.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
206 (if (featurep 'xemacs) (condition-case nil (require 'noutline)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
207 ;; We require noutline, which might be provided in outline.el
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
208 (require 'outline) (require 'noutline)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
209 ;; Other stuff we need.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (require 'time-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 (require 'easymenu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;;; Customization variables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
215 (defvar org-version "4.43"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 "The version number of the file org.el.")
59596
8e7a2f6f9fa7 (org-version): Unnecessary prefix arg removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 59547
diff changeset
217 (defun org-version ()
8e7a2f6f9fa7 (org-version): Unnecessary prefix arg removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 59547
diff changeset
218 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 (message "Org-mode version %s" org-version))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
221 ;; The following constant is for compatibility with different versions
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
222 ;; of outline.el.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (defconst org-noutline-p (featurep 'noutline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 "Are we using the new outline mode?")
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
225 (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
226 (defconst org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
227 (let ((x "a"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
228 (add-text-properties 0 1 '(test t) x)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
229 (get-text-property 0 'test (format "%s" x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
230 "Does format transport text properties?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (defgroup org nil
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
233 "Outline-based notes management and organizer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 :tag "Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 :group 'outlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 :group 'hypermedia
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 :group 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (defgroup org-startup nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 "Options concerning startup of Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 :tag "Org Startup"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
244 (defcustom org-startup-folded t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
245 "Non-nil means, entering Org-mode will switch to OVERVIEW.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
246 This can also be configured on a per-file basis by adding one of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
247 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
248
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
249 #+STARTUP: fold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
250 #+STARTUP: nofold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
251 #+STARTUP: content"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
252 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
253 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
254 (const :tag "nofold: show all" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
255 (const :tag "fold: overview" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
256 (const :tag "content: all headlines" content)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
257
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
258 (defcustom org-startup-truncated t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
259 "Non-nil means, entering Org-mode will set `truncate-lines'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
260 This is useful since some lines containing links can be very long and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
261 uninteresting. Also tables look terrible when wrapped."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
262 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
263 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
264
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
265 (defcustom org-startup-align-all-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
266 "Non-nil means, align all tables when visiting a file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
267 This is useful when the column width in tables is forced with <N> cookies
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
268 in table fields. Such tables will look correct only after the first re-align.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
269 This can also be configured on a per-file basis by adding one of
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
270 the following lines anywhere in the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
271 #+STARTUP: align
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
272 #+STARTUP: noalign"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
273 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
274 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
275
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
276 (defcustom org-startup-with-deadline-check nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
277 "Non-nil means, entering Org-mode will run the deadline check.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
278 This means, if you start editing an org file, you will get an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
279 immediate reminder of any due deadlines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
280 This can also be configured on a per-file basis by adding one of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
281 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
282 #+STARTUP: dlcheck
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
283 #+STARTUP: nodlcheck"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
284 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
285 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
286
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
287 (defcustom org-insert-mode-line-in-empty-file nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
288 "Non-nil means insert the first line setting Org-mode in empty files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
289 When the function `org-mode' is called interactively in an empty file, this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
290 normally means that the file name does not automatically trigger Org-mode.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
291 To ensure that the file will always be in Org-mode in the future, a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
292 line enforcing Org-mode will be inserted into the buffer, if this option
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
293 has been set."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
294 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
295 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
296
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
297 (defcustom org-CUA-compatible nil
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
298 "Non-nil means use alternative key bindings for S-<cursor movement>.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
299 Org-mode used S-<cursor movement> for changing timestamps and priorities.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
300 S-<cursor movement> is also used for example by `CUA-mode' to select text.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
301 If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
302 alternative bindings. Setting this variable to t will replace the following
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
303 keys both in Org-mode and in the Org-agenda buffer.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
304
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
305 S-RET -> C-S-RET
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
306 S-up -> M-p
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
307 S-down -> M-n
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
308 S-left -> M--
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
309 S-right -> M-+
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
310
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
311 If you do not like the alternative keys, take a look at the variable
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
312 `org-disputed-keys'.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
313
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
314 This option is only relevant at load-time of Org-mode. Changing it requires
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
315 a restart of Emacs to become effective."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
316 :group 'org-startup
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
317 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
318
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
319 (defvar org-disputed-keys
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
320 '((S-up [(shift up)] [(meta ?p)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
321 (S-down [(shift down)] [(meta ?n)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
322 (S-left [(shift left)] [(meta ?-)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
323 (S-right [(shift right)] [(meta ?+)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
324 (S-return [(shift return)] [(control shift return)]))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
325 "Keys for which Org-mode and other modes compete.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
326 This is an alist, cars are symbols for lookup, 1st element is the default key,
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
327 second element will be used when `org-CUA-compatible' is t.")
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
328
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
329 (defun org-key (key)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
330 "Select a key according to `org-CUA-compatible'."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
331 (nth (if org-CUA-compatible 2 1)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
332 (or (assq key org-disputed-keys)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
333 (error "Invalid Key %s in `org-key'" key))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
334
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
335 (defcustom org-ellipsis nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
336 "The ellipsis to use in the Org-mode outline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
337 When nil, just use the standard three dots. When a string, use that instead,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
338 and just in Org-mode (which will then use its own display table).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
339 Changing this requires executing `M-x org-mode' in a buffer to become
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
340 effective."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 :group 'org-startup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
342 :type '(choice (const :tag "Default" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
343 (string :tag "String" :value "...#")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
344
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
345 (defvar org-display-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
346 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (defgroup org-keywords nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
349 "Keywords in Org-mode."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 :tag "Org Keywords"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (defcustom org-deadline-string "DEADLINE:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 "String to mark deadline entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 A deadline is this string, followed by a time stamp. Should be a word,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 a timestamp with \\[org-deadline].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 (defcustom org-scheduled-string "SCHEDULED:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 "String to mark scheduled TODO entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 A schedule is this string, followed by a time stamp. Should be a word,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 a timestamp with \\[org-schedule].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
371 (defcustom org-closed-string "CLOSED:"
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
372 "String used as the prefix for timestamps logging closing a TODO entry."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
373 :group 'org-keywords
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
374 :type 'string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
375
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
376 (defcustom org-clock-string "CLOCK:"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
377 "String used as prefix for timestamps clocking work hours on an item."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
378 :group 'org-keywords
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
379 :type 'string)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
380
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (defcustom org-comment-string "COMMENT"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 "Entries starting with this keyword will never be exported.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 An entry can be toggled between COMMENT and normal with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 \\[org-toggle-comment].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
389 (defcustom org-quote-string "QUOTE"
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
390 "Entries starting with this keyword will be exported in fixed-width font.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
391 Quoting applies only to the text in the entry following the headline, and does
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
392 not extend beyond the next headline, even if that is lower level.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
393 An entry can be toggled between QUOTE and normal with
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
394 \\[org-toggle-fixed-width-section]."
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
395 :group 'org-keywords
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
396 :type 'string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
397
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (defgroup org-structure nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
399 "Options concerning the general structure of Org-mode files."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 :tag "Org Structure"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
403 (defgroup org-cycle nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
404 "Options concerning visibility cycling in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
405 :tag "Org Cycle"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
406 :group 'org-structure)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
407
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
408 (defcustom org-cycle-global-at-bob t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
409 "Cycle globally if cursor is at beginning of buffer and not at a headline.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
410 This makes it possible to do global cycling without having to use S-TAB or
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
411 C-u TAB. For this special case to work, the first line of the buffer
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
412 must not be a headline - it may be empty ot some other text. When used in
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
413 this way, `org-cycle-hook' is disables temporarily, to make sure the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
414 cursor stays at the beginning of the buffer.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
415 When this option is nil, don't do anything special at the beginning
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
416 of the buffer."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
417 :group 'org-cycle
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
418 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
419
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
420 (defcustom org-cycle-emulate-tab t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
421 "Where should `org-cycle' emulate TAB.
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
422 nil Never
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
423 white Only in completely white lines
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
424 whitestart Only at the beginning of lines, before the first non-white char.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
425 t Everywhere except in headlines
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
426 If TAB is used in a place where it does not emulate TAB, the current subtree
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
427 visibility is cycled."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
428 :group 'org-cycle
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
429 :type '(choice (const :tag "Never" nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
430 (const :tag "Only in completely white lines" white)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
431 (const :tag "Before first char in a line" whitestart)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
432 (const :tag "Everywhere except in headlines" t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
433 ))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
434
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
435 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
436 org-optimize-window-after-visibility-change)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
437 "Hook that is run after `org-cycle' has changed the buffer visibility.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
438 The function(s) in this hook must accept a single argument which indicates
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
439 the new state that was set by the most recent `org-cycle' command. The
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
440 argument is a symbol. After a global state change, it can have the values
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
441 `overview', `content', or `all'. After a local state change, it can have
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
442 the values `folded', `children', or `subtree'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
443 :group 'org-cycle
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
444 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
445
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
446 (defgroup org-edit-structure nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
447 "Options concerning structure editing in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
448 :tag "Org Edit Structure"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
449 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
450
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
451 (defcustom org-odd-levels-only nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
452 "Non-nil means, skip even levels and only use odd levels for the outline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
453 This has the effect that two stars are being added/taken away in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
454 promotion/demotion commands. It also influences how levels are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
455 handled by the exporters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
456 Changing it requires restart of `font-lock-mode' to become effective
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
457 for fontification also in regions already fontified.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
458 You may also set this on a per-file basis by adding one of the following
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
459 lines to the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
460
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
461 #+STARTUP: odd
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
462 #+STARTUP: oddeven"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
463 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
464 :group 'org-font-lock
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
465 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
466
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
467 (defcustom org-adapt-indentation t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
468 "Non-nil means, adapt indentation when promoting and demoting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
469 When this is set and the *entire* text in an entry is indented, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
470 indentation is increased by one space in a demotion command, and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
471 decreased by one in a promotion command. If any line in the entry
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
472 body starts at column 0, indentation is not changed at all."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
473 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
474 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
475
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
476 (defcustom org-insert-heading-hook nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
477 "Hook being run after inserting a new heading."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
478 :group 'org-edit-structure
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
479 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
480
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
481 (defcustom org-enable-fixed-width-editor t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
482 "Non-nil means, lines starting with \":\" are treated as fixed-width.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
483 This currently only means, they are never auto-wrapped.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
484 When nil, such lines will be treated like ordinary lines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
485 See also the QUOTE keyword."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
486 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
487 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
488
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
489 (defgroup org-sparse-trees nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
490 "Options concerning sparse trees in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
491 :tag "Org Sparse Trees"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
492 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
493
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
494 (defcustom org-highlight-sparse-tree-matches t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
495 "Non-nil means, highlight all matches that define a sparse tree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
496 The highlights will automatically disappear the next time the buffer is
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
497 changed by an edit command."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
498 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
499 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
500
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
501 (defcustom org-show-hierarchy-above t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
502 "Non-nil means, show full hierarchy when showing a spot in the tree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
503 Turning this off makes sparse trees more compact, but also less clear."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
504 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
505 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
506
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
507 (defcustom org-show-following-heading t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
508 "Non-nil means, show heading following match in `org-occur'.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
509 When doing an `org-occur' it is useful to show the headline which
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
510 follows the match, even if they do not match the regexp. This makes it
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
511 easier to edit directly inside the sparse tree. However, if you use
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
512 `org-occur' mainly as an overview, the following headlines are
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
513 unnecessary clutter."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
514 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
515 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
516
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
517 (defcustom org-occur-hook '(org-first-headline-recenter)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
518 "Hook that is run after `org-occur' has constructed a sparse tree.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
519 This can be used to recenter the window to show as much of the structure
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
520 as possible."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
521 :group 'org-sparse-trees
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
522 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
523
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
524 (defgroup org-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
525 "Options concerning plain lists in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
526 :tag "Org Plain lists"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
527 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
528
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
529 (defcustom org-cycle-include-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
530 "Non-nil means, include plain lists into visibility cycling.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
531 This means that during cycling, plain list items will *temporarily* be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
532 interpreted as outline headlines with a level given by 1000+i where i is the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
533 indentation of the bullet. In all other operations, plain list items are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
534 not seen as headlines. For example, you cannot assign a TODO keyword to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
535 such an item."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
536 :group 'org-plain-lists
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
537 :type 'boolean)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
538
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
540 (defcustom org-plain-list-ordered-item-terminator t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
541 "The character that makes a line with leading number an ordered list item.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
542 Valid values are ?. and ?\). To get both terminators, use t. While
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
543 ?. may look nicer, it creates the danger that a line with leading
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
544 number may be incorrectly interpreted as an item. ?\) therefore is
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
545 the safe choice."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
546 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
547 :type '(choice (const :tag "dot like in \"2.\"" ?.)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
548 (const :tag "paren like in \"2)\"" ?\))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
549 (const :tab "both" t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
550
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
551 (defcustom org-auto-renumber-ordered-lists t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
552 "Non-nil means, automatically renumber ordered plain lists.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
553 Renumbering happens when the sequence have been changed with
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
554 \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
555 use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
556 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
557 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
558
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
559 (defgroup org-archive nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
560 "Options concerning archiving in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
561 :tag "Org Archive"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
562 :group 'org-structure)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
563
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
564 (defcustom org-archive-tag "ARCHIVE"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
565 "The tag that marks a subtree as archived.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
566 An archived subtree does not open during visibility cycling, and does
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
567 not contribute to the agenda listings."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
568 :group 'org-archive
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
569 :group 'org-keywords
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
570 :type 'string)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
571
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
572 (defcustom org-agenda-skip-archived-trees t
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
573 "Non-nil means, the agenda will skip any items located in archived trees.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
574 An archived tree is a tree marked with the tag ARCHIVE."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
575 :group 'org-archive
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
576 :group 'org-agenda-display
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
577 :type 'boolean)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
578
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
579 (defcustom org-cycle-open-archived-trees nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
580 "Non-nil means, `org-cycle' will open archived trees.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
581 An archived tree is a tree marked with the tag ARCHIVE.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
582 When nil, archived trees will stay folded. You can still open them with
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
583 normal outline commands like `show-all', but not with the cycling commands."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
584 :group 'org-archive
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
585 :group 'org-cycle
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
586 :type 'boolean)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
587
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
588 (defcustom org-sparse-tree-open-archived-trees nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
589 "Non-nil means sparse tree construction shows matches in archived trees.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
590 When nil, matches in these trees are highlighted, but the trees are kept in
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
591 collapsed state."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
592 :group 'org-archive
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
593 :group 'org-sparse-trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
594 :type 'boolean)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
595
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
596 (defcustom org-archive-location "%s_archive::"
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
597 "The location where subtrees should be archived.
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
598 This string consists of two parts, separated by a double-colon.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
599
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
600 The first part is a file name - when omitted, archiving happens in the same
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
601 file. %s will be replaced by the current file name (without directory part).
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
602 Archiving to a different file is useful to keep archived entries from
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
603 contributing to the Org-mode Agenda.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
604
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
605 The part after the double colon is a headline. The archived entries will be
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
606 filed under that headline. When omitted, the subtrees are simply filed away
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
607 at the end of the file, as top-level entries.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
608
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
609 Here are a few examples:
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
610 \"%s_archive::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
611 If the current file is Projects.org, archive in file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
612 Projects.org_archive, as top-level trees. This is the default.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
613
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
614 \"::* Archived Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
615 Archive in the current file, under the top-level headline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
616 \"* Archived Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
617
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
618 \"~/org/archive.org::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
619 Archive in file ~/org/archive.org (absolute path), as top-level trees.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
620
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
621 \"basement::** Finished Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
622 Archive in file ./basement (relative path), as level 3 trees
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
623 below the level 2 heading \"** Finished Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
624
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
625 You may set this option on a per-file basis by adding to the buffer a
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
626 line like
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
627
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
628 #+ARCHIVE: basement::** Finished Tasks"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
629 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
630 :type 'string)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
631
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
632 (defcustom org-archive-mark-done t
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
633 "Non-nil means, mark entries as DONE when they are moved to the archive file."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
634 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
635 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
636
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
637 (defcustom org-archive-stamp-time t
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
638 "Non-nil means, add a time stamp to entries moved to an archive file.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
639 The time stamp will be added directly after the TODO state keyword in the
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
640 first line, so it is probably best to use this in combinations with
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
641 `org-archive-mark-done'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
642 :group 'org-archive
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (defgroup org-table nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 "Options concerning tables in Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 :tag "Org Table"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
650 (defcustom org-enable-table-editor 'optimized
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 "Non-nil means, lines starting with \"|\" are handled by the table editor.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
652 When nil, such lines will be treated like ordinary lines.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
653
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
654 When equal to the symbol `optimized', the table editor will be optimized to
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
655 do the following:
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
656 - Use automatic overwrite mode in front of whitespace in table fields.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
657 This make the structure of the table stay in tact as long as the edited
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
658 field does not exceed the column width.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
659 - Minimize the number of realigns. Normally, the table is aligned each time
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
660 TAB or RET are pressed to move to another field. With optimization this
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
661 happens only if changes to a field might have changed the column width.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
662 Optimization requires replacing the functions `self-insert-command',
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
663 `delete-char', and `backward-delete-char' in Org-mode buffers, with a
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
664 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
665 very good at guessing when a re-align will be necessary, but you can always
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
666 force one with \\[org-ctrl-c-ctrl-c].
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
667
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
668 If you would like to use the optimized version in Org-mode, but the
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
669 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
670
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
671 This variable can be used to turn on and off the table editor during a session,
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
672 but in order to toggle optimization, a restart is required.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
673
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
674 See also the variable `org-table-auto-blank-field'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 :group 'org-table
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
676 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
677 (const :tag "off" nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
678 (const :tag "on" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
679 (const :tag "on, optimized" optimized)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
681 (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
682 "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
683 In the optimized version, the table editor takes over all simple keys that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
684 normally just insert a character. In tables, the characters are inserted
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
685 in a way to minimize disturbing the table structure (i.e. in overwrite mode
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
686 for empty fields). Outside tables, the correct binding of the keys is
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
687 restored.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
688
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
689 The default for this option is t if the optimized version is also used in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
690 Org-mode. See the variable `org-enable-table-editor' for details. Changing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
691 this variable requires a restart of Emacs to become effective."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
692 :group 'org-table
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
693 :type 'boolean)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
694
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
695 (defgroup org-table-settings nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
696 "Settings for tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
697 :tag "Org Table Settings"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
698 :group 'org-table)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
699
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 (defcustom org-table-default-size "5x2"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 "The default size for newly created tables, Columns x Rows."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
702 :group 'org-table-settings
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
703 :type 'string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 "Regular expression for recognizing numbers in table columns.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 If a table column contains mostly numbers, it will be aligned to the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 right. If not, it will be aligned to the left.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 The default value of this option is a regular expression which allows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 anything which looks remotely like a number as used in scientific
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 context. For example, all of the following will be considered a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 number:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 12 12.2 2.4e-08 2x10^12 4.034+-0.02 2.7(10) >3.5
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 Other options offered by the customize interface are more restrictive."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
717 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
719 (const :tag "Positive Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
720 "^[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
721 (const :tag "Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
722 "^[-+]?[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
723 (const :tag "Floating Point Numbers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
724 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
725 (const :tag "Floating Point Number or Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
726 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
727 (const :tag "Exponential, Floating point, Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
728 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
729 (const :tag "Very General Number-Like"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
730 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
731 (string :tag "Regexp:")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 (defcustom org-table-number-fraction 0.5
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 "Fraction of numbers in a column required to make the column align right.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 In a column all non-white fields are considered. If at least this
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 fraction of fields is matched by `org-table-number-fraction',
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 alignment to the right border applies."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
738 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 :type 'number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
741 (defgroup org-table-editing nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
742 "Bahavior of tables during editing in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
743 :tag "Org Table Editing"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
744 :group 'org-table)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
745
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
746 (defcustom org-table-automatic-realign t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
747 "Non-nil means, automatically re-align table when pressing TAB or RETURN.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
748 When nil, aligning is only done with \\[org-table-align], or after column
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
749 removal/insertion."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
750 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
751 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
752
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
753 (defcustom org-table-limit-column-width t ;kw
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
754 "Non-nil means, allow to limit the width of table columns with <N> fields."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
755 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
756 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
757
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
758 (defcustom org-table-auto-blank-field t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
759 "Non-nil means, automatically blank table field when starting to type into it.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
760 This only happens when typing immediately after a field motion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
761 command (TAB, S-TAB or RET).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
762 Only relevant when `org-enable-table-editor' is equal to `optimized'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
763 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
764 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
765
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
766 (defcustom org-table-tab-jumps-over-hlines t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
767 "Non-nil means, tab in the last column of a table with jump over a hline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
768 If a horizontal separator line is following the current line,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
769 `org-table-next-field' can either create a new row before that line, or jump
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
770 over the line. When this option is nil, a new line will be created before
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
771 this line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
772 :group 'org-table-editing
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
775 (defcustom org-table-tab-recognizes-table.el t
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
776 "Non-nil means, TAB will automatically notice a table.el table.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
777 When it sees such a table, it moves point into it and - if necessary -
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
778 calls `table-recognize-table'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
779 :group 'org-table-editing
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
780 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
781
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
782 (defgroup org-table-calculation nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
783 "Options concerning tables in Org-mode."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
784 :tag "Org Table Calculation"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
785 :group 'org-table)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
786
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
787 (defcustom org-table-copy-increment t
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
788 "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
789 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
790 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
791
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
792 (defcustom org-calc-default-modes
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
793 '(calc-internal-prec 12
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
794 calc-float-format (float 5)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
795 calc-angle-mode deg
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
796 calc-prefer-frac nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
797 calc-symbolic-mode nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
798 calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
799 calc-display-working-message t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
800 )
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
801 "List with Calc mode settings for use in calc-eval for table formulas.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
802 The list must contain alternating symbols (Calc modes variables and values).
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
803 Don't remove any of the default settings, just change the values. Org-mode
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
804 relies on the variables to be present in the list."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
805 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
806 :type 'plist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
807
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
808 (defcustom org-table-formula-evaluate-inline t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
809 "Non-nil means, TAB and RET evaluate a formula in current table field.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
810 If the current field starts with an equal sign, it is assumed to be a formula
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
811 which should be evaluated as described in the manual and in the documentation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
812 string of the command `org-table-eval-formula'. This feature requires the
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
813 Emacs calc package.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
814 When this variable is nil, formula calculation is only available through
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
815 the command \\[org-table-eval-formula]."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
816 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
817 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
818
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
819
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
820 (defcustom org-table-formula-use-constants t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
821 "Non-nil means, interpret constants in formulas in tables.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
822 A constant looks like `$c' or `$Grav' and will be replaced before evaluation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
823 by the value given in `org-table-formula-constants', or by a value obtained
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
824 from the `constants.el' package."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
825 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
826 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
827
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
828 (defcustom org-table-formula-constants nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
829 "Alist with constant names and values, for use in table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
830 The car of each element is a name of a constant, without the `$' before it.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
831 The cdr is the value as a string. For example, if you'd like to use the
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
832 speed of light in a formula, you would configure
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
833
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
834 (setq org-table-formula-constants '((\"c\" . \"299792458.\")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
835
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
836 and then use it in an equation like `$1*$c'."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
837 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
838 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
839 (cons (string :tag "name")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
840 (string :tag "value"))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
841
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
842 (defcustom org-table-formula-numbers-only nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
843 "Non-nil means, calculate only with numbers in table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
844 Then all input fields will be converted to a number, and the result
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
845 must also be a number. When nil, calc's full potential is available
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
846 in table calculations, including symbolics etc."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
847 :group 'org-table-calculation
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
848 :type 'boolean)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
849
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
850 (defcustom org-table-allow-automatic-line-recalculation t
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
851 "Non-nil means, lines marked with |#| or |*| will be recomputed automatically.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
852 Automatically means, when TAB or RET or C-c C-c are pressed in the line."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
853 :group 'org-table-calculation
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
856 (defgroup org-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
857 "Options concerning links in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
858 :tag "Org Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
859 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
860
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
861 (defcustom org-descriptive-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
862 "Non-nil means, hide link part and only show description of bracket links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
863 Bracket links are like [[link][descritpion]]. This variable sets the initial
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
864 state in new org-mode buffers. The setting can then be toggled on a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
865 per-buffer basis from the Org->Hyperlinks menu."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
866 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
867 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
868
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
869 (defcustom org-link-style 'bracket
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
870 "The style of links to be inserted with \\[org-insert-link].
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
871 Possible values are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
872 bracket [[link][description]]. This is recommended
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
873 plain Description \\n link. The old way, no longer recommended."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
874 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
875 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
876 (const :tag "Bracket (recommended)" bracket)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
877 (const :tag "Plain (no longer recommended)" plain)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
878
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
879 (defcustom org-link-format "%s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
880 "Default format for external, URL-like linkes in the buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
881 This is a format string for printf, %s will be replaced by the link text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
882 The recommended value is just \"%s\", since links will be protected by
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
883 enclosing them in double brackets. If you prefer plain links (see variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
884 `org-link-style'), \"<%s>\" is useful. Some people also recommend an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
885 additional URL: prefix, so the format would be \"<URL:%s>\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
886 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
887 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
888 (const :tag "\"%s\" (e.g. http://www.there.com)" "%s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
889 (const :tag "\"<%s>\" (e.g. <http://www.there.com>)" "<%s>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
890 (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
891 (string :tag "Other" :value "<%s>")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
892
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
893 (defcustom org-link-file-path-type 'adaptive
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
894 "How the path name in file links should be stored.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
895 Valid values are:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
896
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
897 relative relative to the current directory, i.e. the directory of the file
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
898 into which the link is being inserted.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
899 absolute absolute path, if possible with ~ for home directory.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
900 noabbrev absolute path, no abbreviation of home directory.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
901 adaptive Use relative path for files in the current directory and sub-
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
902 directories of it. For other files, use an absolute path."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
903 :group 'org-link
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
904 :type '(choice
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
905 (const relative)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
906 (const absolute)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
907 (const noabbrev)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
908 (const adaptive)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
909
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
910 (defcustom org-activate-links '(bracket angle plain radio tag date)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
911 "Types of links that should be activated in Org-mode files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
912 This is a list of symbols, each leading to the activation of a certain link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
913 type. In principle, it does not hurt to turn on most link types - there may
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
914 be a small gain when turning off unused link types. The types are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
915
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
916 bracket The recommended [[link][description]] or [[link]] links with hiding.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
917 angular Links in angular brackes that may contain whitespace like
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
918 <bbdb:Carsten Dominik>.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
919 plain Plain links in normal text, no whitespace, like http://google.com.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
920 radio Text that is matched by a radio target, see manual for details.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
921 tag Tag settings in a headline (link to tag search).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
922 date Time stamps (link to calendar).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
923 camel CamelCase words defining text searches.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
924
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
925 Changing this variable requires a restart of Emacs to become effective."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
926 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
927 :type '(set (const :tag "Double bracket links (new style)" bracket)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
928 (const :tag "Angular bracket links (old style)" angular)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
929 (const :tag "plain text links" plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
930 (const :tag "Radio target matches" radio)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
931 (const :tag "Tags" tag)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
932 (const :tag "Timestamps" date)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
933 (const :tag "CamelCase words" camel)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
934
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
935 (defgroup org-link-store nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
936 "Options concerning storing links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
937 :tag "Org Store Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
938 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
939
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
940 (defcustom org-context-in-file-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
941 "Non-nil means, file links from `org-store-link' contain context.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
942 A search string will be added to the file name with :: as separator and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
943 used to find the context when the link is activated by the command
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
944 `org-open-at-point'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
945 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
946 negates this setting for the duration of the command."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
947 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
948 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
949
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
950 (defcustom org-file-link-context-use-camel-case nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
951 "Non-nil means, use CamelCase to store a search context in a file link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
952 When nil, the search string simply consists of the words of the string.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
953 CamelCase is deprecated, and support for it may be dropped in the future."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
954 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
955 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
956
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
957 (defcustom org-keep-stored-link-after-insertion nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
958 "Non-nil means, keep link in list for entire session.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
959
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
960 The command `org-store-link' adds a link pointing to the current
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
961 location to an internal list. These links accumulate during a session.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
962 The command `org-insert-link' can be used to insert links into any
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
963 Org-mode file (offering completion for all stored links). When this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
964 option is nil, every link which has been inserted once using \\[org-insert-link]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
965 will be removed from the list, to make completing the unused links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
966 more efficient."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
967 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
968 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
969
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
970 (defcustom org-usenet-links-prefer-google nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
971 "Non-nil means, `org-store-link' will create web links to Google groups.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
972 When nil, Gnus will be used for such links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
973 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
974 negates this setting for the duration of the command."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
975 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
976 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
977
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
978 (defgroup org-link-follow nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
979 "Options concerning following links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
980 :tag "Org Follow Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
981 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
982
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
983 (defcustom org-tab-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
984 "Non-nil means, on links TAB will follow the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
985 Needs to be set before org.el is loaded."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
986 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
987 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
988
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
989 (defcustom org-return-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
990 "Non-nil means, on links RET will follow the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
991 Needs to be set before org.el is loaded."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
992 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
993 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
994
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
995 (defcustom org-mouse-1-follows-link t
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
996 "Non-nil means, mouse-1 on a link will follow the link.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
997 A longer mouse click will still set point. Does not wortk on XEmacs.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
998 Needs to be set before org.el is loaded."
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
999 :group 'org-link-follow
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1000 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1001
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1002 (defcustom org-mark-ring-length 4
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1003 "Number of different positions to be recorded in the ring
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1004 Changing this requires a restart of Emacs to work correctly."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1005 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1006 :type 'interger)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1007
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1008 (defcustom org-link-frame-setup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1009 '((vm . vm-visit-folder-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1010 (gnus . gnus-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1011 (file . find-file-other-window))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1012 "Setup the frame configuration for following links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1013 When following a link with Emacs, it may often be useful to display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1014 this link in another window or frame. This variable can be used to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1015 set this up for the different types of links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1016 For VM, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1017 `vm-visit-folder'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1018 `vm-visit-folder-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1019 For Gnus, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1020 `gnus'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1021 `gnus-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1022 For FILE, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1023 `find-file'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1024 `find-file-other-window'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1025 `find-file-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1026 For the calendar, use the variable `calendar-setup'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1027 For BBDB, it is currently only possible to display the matches in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1028 another window."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1029 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1030 :type '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1031 (cons (const vm)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1032 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1033 (const vm-visit-folder)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1034 (const vm-visit-folder-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1035 (const vm-visit-folder-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1036 (cons (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1037 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1038 (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1039 (const gnus-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1040 (cons (const file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1041 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1042 (const find-file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1043 (const find-file-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1044 (const find-file-other-frame)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1045
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1046 (defcustom org-open-non-existing-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1047 "Non-nil means, `org-open-file' will open non-existing file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1048 When nil, an error will be generated."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1049 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1050 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1051
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1052 (defcustom org-confirm-shell-link-function 'yes-or-no-p
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1053 "Non-nil means, ask for confirmation before executing shell links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1054 Shell links can be dangerous, just thing about a link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1055
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1056 [[shell:rm -rf ~/*][Google Search]]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1057
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1058 This link would show up in your Org-mode document as \"Google Search\"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1059 but really it would remove your entire home directory.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1060 Therefore I *definitely* advise against setting this variable to nil.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1061 Just change it to `y-or-n-p' of you want to confirm with a single key press
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1062 rather than having to type \"yes\"."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1063 :group 'org-link-follow
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1064 :type '(choice
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1065 (const :tag "with yes-or-no (safer)" yes-or-no-p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1066 (const :tag "with y-or-n (faster)" y-or-n-p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1067 (const :tag "no confirmation (dangerous)" nil)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1068
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1069 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1070 "Non-nil means, ask for confirmation before executing elisp links.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1071 Elisp links can be dangerous, just thing about a link
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1072
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1073 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1074
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1075 This link would show up in your Org-mode document as \"Google Search\"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1076 but really it would remove your entire home directory.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1077 Therefore I *definitely* advise against setting this variable to nil.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1078 Just change it to `y-or-n-p' of you want to confirm with a single key press
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1079 rather than having to type \"yes\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1080 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1081 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1082 (const :tag "with yes-or-no (safer)" yes-or-no-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1083 (const :tag "with y-or-n (faster)" y-or-n-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1084 (const :tag "no confirmation (dangerous)" nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1085
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1086 (defconst org-file-apps-defaults-gnu
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1087 '((remote . emacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1088 (t . mailcap))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1089 "Default file applications on a UNIX or GNU/Linux system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1090 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1091
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1092 (defconst org-file-apps-defaults-macosx
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1093 '((remote . emacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1094 (t . "open %s")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1095 ("ps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1096 ("ps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1097 ("eps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1098 ("eps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1099 ("dvi" . "xdvi %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1100 ("fig" . "xfig %s"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1101 "Default file applications on a MacOS X system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1102 The system \"open\" is known as a default, but we use X11 applications
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1103 for some files for which the OS does not have a good default.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1104 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1105
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1106 (defconst org-file-apps-defaults-windowsnt
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1107 (list
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1108 '(remote . emacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1109 (cons t
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1110 (list (if (featurep 'xemacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1111 'mswindows-shell-execute
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1112 'w32-shell-execute)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1113 "open" 'file)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1114 "Default file applications on a Windows NT system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1115 The system \"open\" is used for most files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1116 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1117
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1118 (defcustom org-file-apps
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1119 '(
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1120 ("txt" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1121 ("tex" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1122 ("ltx" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1123 ("org" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1124 ("el" . emacs)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1125 ("bib" . emacs)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1126 )
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1127 "External applications for opening `file:path' items in a document.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1128 Org-mode uses system defaults for different file types, but
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1129 you can use this variable to set the application for a given file
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1130 extension. The entries in this list are cons cells where the car identifies
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1131 files and the cdr the corresponding command. Possible values for the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1132 file identifier are
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1133 \"ext\" A string identifying an extension
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1134 `directory' Matches a directory
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1135 `remote' Matches a remove file, accessible through tramp or efs.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1136 Remote files most likely should be visited through emacs
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1137 because external applications cannot handle such paths.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1138 t Default for all remaining files
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1139
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1140 Possible values for the command are:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1141 `emacs' The file will be visited by the current Emacs process.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1142 `default' Use the default application for this file type.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1143 string A command to be executed by a shell; %s will be replaced
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1144 by the path to the file.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1145 sexp A Lisp form which will be evaluated. The file path will
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1146 be available in the Lisp variable `file'.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1147 For more examples, see the system specific constants
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1148 `org-file-apps-defaults-macosx'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1149 `org-file-apps-defaults-windowsnt'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1150 `org-file-apps-defaults-gnu'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1151 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1152 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1153 (cons (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1154 (string :tag "Extension")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1155 (const :tag "Default for unrecognized files" t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1156 (const :tag "Remote file" remote)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1157 (const :tag "Links to a directory" directory))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1158 (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1159 (const :tag "Visit with Emacs" emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1160 (const :tag "Use system default" default)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1161 (string :tag "Command")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1162 (sexp :tag "Lisp form")))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1163
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1164 (defcustom org-mhe-search-all-folders nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1165 "Non-nil means, that the search for the mh-message will be extended to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1166 all folders if the message cannot be found in the folder given in the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1167 Searching all folders is very effective with one of the search engines
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1168 supported by MH-E, but will be slow with pick."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1169 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1170 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1171
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1172 (defgroup org-remember nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1173 "Options concerning interaction with remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1174 :tag "Org Remember"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1175 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1176
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1177 (defcustom org-directory "~/org"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1178 "Directory with org files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1179 This directory will be used as default to prompt for org files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1180 Used by the hooks for remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1181 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1182 :type 'directory)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1183
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1184 (defcustom org-default-notes-file "~/.notes"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1185 "Default target for storing notes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1186 Used by the hooks for remember.el. This can be a string, or nil to mean
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1187 the value of `remember-data-file'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1188 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1189 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1190 (const :tag "Default from remember-data-file" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1191 file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1192
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1193 (defcustom org-remember-templates nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1194 "Templates for the creation of remember buffers.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1195 When nil, just let remember make the buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1196 When not nil, this is a list of 3-element lists. In each entry, the first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1197 element is a character, a unique key to select this template.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1198 The second element is the template. The third element is optional and can
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1199 specify a destination file for remember items created with this template.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1200 The default file is given by `org-default-notes-file'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1201
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1202 The template specifies the structure of the remember buffer. It should have
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1203 a first line starting with a star, to act as the org-mode headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1204 Furthermore, the following %-escapes will be replaced with content:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1205 %t time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1206 %T time stamp with date and time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1207 %u inactive time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1208 %U inactive time stamp with date and time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1209 %n user name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1210 %a annotation, normally the link created with org-store-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1211 %i initial content, the region when remember is called with C-u.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1212 If %i is indented, the entire inserted text will be indented as well.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1213 %? This will be removed, and the cursor placed at this position."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1214 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1215 :type '(repeat :tag "enabled"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1216 (list :value (?a "\n" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1217 (character :tag "Selection Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1218 (string :tag "Template")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1219 (file :tag "Destination file (optional)"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1220
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1221 (defcustom org-reverse-note-order nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1222 "Non-nil means, store new notes at the beginning of a file or entry.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1223 When nil, new notes will be filed to the end of a file or entry."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1224 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1225 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1226 (const :tag "Reverse always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1227 (const :tag "Reverse never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1228 (repeat :tag "By file name regexp"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1229 (cons regexp boolean))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1230
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1231 (defgroup org-todo nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1232 "Options concerning TODO items in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1233 :tag "Org TODO"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1234 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1235
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1236 (defcustom org-todo-keywords '("TODO" "DONE")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1237 "List of TODO entry keywords.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1238 \\<org-mode-map>By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1239 considered to mean that the entry is \"done\". All the other mean that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1240 action is required, and will make the entry show up in todo lists, diaries
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1241 etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1242 The command \\[org-todo] cycles an entry through these states, and an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1243 additional state where no keyword is present. For details about this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1244 cycling, see also the variable `org-todo-interpretation'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1245 Changes become only effective after restarting Emacs."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1246 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1247 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1248 :type '(repeat (string :tag "Keyword")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1249
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1250 (defcustom org-todo-interpretation 'sequence
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1251 "Controls how TODO keywords are interpreted.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1252 This variable is only relevant if `org-todo-keywords' contains more than two
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1253 states. \\<org-mode-map>Possible values are `sequence' and `type'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1254
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1255 When `sequence', \\[org-todo] will always switch to the next state in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1256 `org-todo-keywords' list. When `type', \\[org-todo] only cycles from state
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1257 to state when executed several times in direct succession. Otherwise, it
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1258 switches directly to DONE from any state.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1259 See the manual for more information."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1260 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1261 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1262 :type '(choice (const sequence)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1263 (const type)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1264
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1265 (defcustom org-after-todo-state-change-hook nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1266 "Hook which is run after the state of a TODO item was changed.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1267 The new state (a string with a TODO keyword, or nil) is available in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1268 Lisp variable `state'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1269 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1270 :type 'hook)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1271
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1272 (defcustom org-log-done nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1273 "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1274 When the state of an entry is changed from nothing to TODO, remove a previous
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1275 closing date.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1276 This can also be configured on a per-file basis by adding one of
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1277 the following lines anywhere in the buffer:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1278
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1279 #+STARTUP: logging
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1280 #+STARTUP: nologging"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1281 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1282 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1283
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1284 (defgroup org-priorities nil
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1285 "Priorities in Org-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1286 :tag "Org Priorities"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1287 :group 'org-todo)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1288
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1289 (defcustom org-default-priority ?B
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1290 "The default priority of TODO items.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1291 This is the priority an item get if no explicit priority is given."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1292 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1293 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1294
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1295 (defcustom org-lowest-priority ?C
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1296 "The lowest priority of TODO items. A character like ?A, ?B etc."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1297 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1298 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1299
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1300 (defgroup org-time nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1301 "Options concerning time stamps and deadlines in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1302 :tag "Org Time"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1303 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1304
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1305 (defcustom org-insert-labeled-timestamps-at-point nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1306 "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1307 When nil, these labeled time stamps are forces into the second line of an
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1308 entry, just after the headline. When scheduling from the global TODO list,
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1309 the time stamp will always be forced into the second line."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1310 :group 'org-time
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1311 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1312
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1313 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1314 "Formats for `format-time-string' which are used for time stamps.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1315 It is not recommended to change this constant.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1316
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1317 (defcustom org-time-stamp-rounding-minutes 0
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1318 "Number of minutes to round time stamps to upon insertion.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1319 When zero, insert the time unmodified. Useful rounding numbers
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1320 should be factors of 60, so for example 5, 10, 15.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1321 When this is not zero, you can still force an exact time-stamp by using
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1322 a double prefix argument to a time-stamp command like `C-c .' or `C-c !'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1323 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1324 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1325
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1326 (defcustom org-deadline-warning-days 30
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1327 "No. of days before expiration during which a deadline becomes active.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1328 This variable governs the display in the org file."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1329 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1330 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1331
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1332 (defcustom org-popup-calendar-for-date-prompt t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1333 "Non-nil means, pop up a calendar when prompting for a date.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1334 In the calendar, the date can be selected with mouse-1. However, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1335 minibuffer will also be active, and you can simply enter the date as well.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1336 When nil, only the minibuffer will be available."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1337 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1338 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1339
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1340 (defcustom org-calendar-follow-timestamp-change t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1341 "Non-nil means, make the calendar window follow timestamp changes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1342 When a timestamp is modified and the calendar window is visible, it will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1343 moved to the new date."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1344 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1345 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1346
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1347 (defgroup org-tags nil
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1348 "Options concerning tags in Org-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1349 :tag "Org Tags"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1350 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1351
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1352 (defcustom org-tag-alist nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1353 "List of tags allowed in Org-mode files.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1354 When this list is nil, Org-mode will base TAG input on what is already in the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1355 buffer.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1356 The value of this variable is an alist, the car may be (and should) be a
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1357 character that is used to select that tag through the fast-tag-selection
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1358 interface. See the manual for details."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1359 :group 'org-tags
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1360 :type '(repeat
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1361 (choice
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1362 (cons (string :tag "Tag name")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1363 (character :tag "Access char"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1364 (const :tag "Start radio group" (:startgroup))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1365 (const :tag "End radio group" (:endgroup)))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1366
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1367 (defcustom org-use-fast-tag-selection 'auto
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1368 "Non-nil means, use fast tag selection scheme.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1369 This is a special interface to select and deselect tags with single keys.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1370 When nil, fast selection is never used.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1371 When the symbol `auto', fast selection is used if and only if selection
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1372 characters for tags have been configured, either through the variable
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1373 `org-tag-alist' or through a #+TAGS line in the buffer.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1374 When t, fast selection is always used and selection keys are assigned
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1375 automatically if necessary."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1376 :group 'org-tags
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1377 :type '(choice
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1378 (const :tag "Always" t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1379 (const :tag "Never" nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1380 (const :tag "When selection characters are configured" 'auto)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1381
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1382 (defcustom org-tags-column 48
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1383 "The column to which tags should be indented in a headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1384 If this number is positive, it specifies the column. If it is negative,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1385 it means that the tags should be flushright to that column. For example,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1386 -79 works well for a normal 80 character screen."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1387 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1388 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1389
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1390 (defcustom org-auto-align-tags t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1391 "Non-nil means, realign tags after pro/demotion of TODO state change.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1392 These operations change the length of a headline and therefore shift
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1393 the tags around. With this options turned on, after each such operation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1394 the tags are again aligned to `org-tags-column'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1395 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1396 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1397
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1398 (defcustom org-use-tag-inheritance t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1399 "Non-nil means, tags in levels apply also for sublevels.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1400 When nil, only the tags directly given in a specific line apply there.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1401 If you turn off this option, you very likely want to turn on the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1402 companion option `org-tags-match-list-sublevels'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1403 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1404 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1405
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1406 (defcustom org-tags-match-list-sublevels nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1407 "Non-nil means list also sublevels of headlines matching tag search.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1408 Because of tag inheritance (see variable `org-use-tag-inheritance'),
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1409 the sublevels of a headline matching a tag search often also match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1410 the same search. Listing all of them can create very long lists.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1411 Setting this variable to nil causes subtrees of a match to be skipped.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1412 This option is off by default, because inheritance in on. If you turn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1413 inheritance off, you very likely want to turn this option on.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1414
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1415 As a special case, if the tag search is restricted to TODO items, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1416 value of this variable is ignored and sublevels are always checked, to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1417 make sure all corresponding TODO items find their way into the list."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1418 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1419 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1420
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1421 (defvar org-tags-history nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1422 "History of minibuffer reads for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1423 (defvar org-last-tags-completion-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1424 "The last used completion table for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1425
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1426 (defgroup org-agenda nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1427 "Options concerning agenda display Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1428 :tag "Org Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1429 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1430
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1431 (defvar org-category nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1432 "Variable used by org files to set a category for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1433 Such files should use a file variable to set it, for example
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1434
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1435 -*- mode: org; org-category: \"ELisp\"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1436
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1437 or contain a special line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1438
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1439 #+CATEGORY: ELisp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1440
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1441 If the file does not specify a category, then file's base name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1442 is used instead.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1443 (make-variable-buffer-local 'org-category)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1444
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1445 (defcustom org-agenda-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1446 "The files to be used for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1447 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1448 \\[org-remove-file]. You can also use customize to edit the list.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1449
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1450 If the value of the variable is not a list but a single file name, then
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1451 the list of agenda files is actually stored and maintained in that file, one
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1452 agenda file per line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1453 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1454 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1455 (repeat :tag "List of files" file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1456 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1457
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1458 (defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1459 "Custom commands for the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1460 These commands will be offered on the splash screen displayed by the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1461 agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1462
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1463 key The key (a single char as a string) to be associated with the command.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1464 type The command type, any of the following symbols:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1465 todo Entries with a specific TODO keyword, in all agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1466 tags Tags match in all agenda files.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1467 tags-todo Tags match in all agenda files, TODO entries only.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1468 todo-tree Sparse tree of specific TODO keyword in *current* file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1469 tags-tree Sparse tree with all tags matches in *current* file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1470 occur-tree Occur sparse tree for current file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1471 match What to search for:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1472 - a single keyword for TODO keyword searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1473 - a tags match expression for tags searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1474 - a regular expression for occur searches"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1475 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1476 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1477 (list (string :tag "Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1478 (choice :tag "Type"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1479 (const :tag "Tags search in all agenda files" tags)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1480 (const :tag "Tags search of TODO entries, all agenda files" tags-todo)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1481 (const :tag "TODO keyword search in all agenda files" todo)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1482 (const :tag "Tags sparse tree in current buffer" tags-tree)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1483 (const :tag "TODO keyword tree in current buffer" todo-tree)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1484 (const :tag "Occur tree in current buffer" occur-tree))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1485 (string :tag "Match"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1486
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1487 (defcustom org-agenda-todo-list-sublevels t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1488 "Non-nil means, check also the sublevels of a TODO entry for TODO entries.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1489 When nil, the sublevels of a TODO entry are not checked, resulting in
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1490 potentially much shorter TODO lists."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1491 :group 'org-agenda
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1492 :group 'org-todo
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1493 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1494
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1495 (defcustom org-agenda-todo-ignore-scheduled nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1496 "Non-nil means, don't show scheduled entries in the global todo list.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1497 The idea behind this is that by scheduling it, you have already taken care
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1498 of this item."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1499 :group 'org-agenda
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1500 :group 'org-todo
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1501 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1502
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1503 (defcustom org-agenda-include-all-todo nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1504 "Non-nil means, the agenda will always contain all TODO entries.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1505 When nil, date-less entries will only be shown if `org-agenda' is called
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1506 with a prefix argument.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1507 When non-nil, the TODO entries will be listed at the top of the agenda, before
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1508 the entries for specific days."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1509 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1510 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1511
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1512 (defcustom org-agenda-include-diary nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1513 "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1514 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1515 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1516
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1517 (defcustom org-calendar-to-agenda-key [?c]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1518 "The key to be installed in `calendar-mode-map' for switching to the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1519 The command `org-calendar-goto-agenda' will be bound to this key. The
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1520 default is the character `c' because then `c' can be used to switch back and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1521 forth between agenda and calendar."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1522 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1523 :type 'sexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1524
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1525 (defgroup org-agenda-setup nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1526 "Options concerning setting up the Agenda window in Org Mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1527 :tag "Org Agenda Window Setup"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1528 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1529
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1530 (defcustom org-agenda-mouse-1-follows-link nil
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1531 "Non-nil means, mouse-1 on a link will follow the link in the agenda.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1532 A longer mouse click will still set point. Does not wortk on XEmacs.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1533 Needs to be set before org.el is loaded."
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1534 :group 'org-agenda-setup
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1535 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1536
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1537 (defcustom org-agenda-start-with-follow-mode nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1538 "The initial value of follwo-mode in a newly created agenda window."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1539 :group 'org-agenda-setup
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1540 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1541
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1542 (defcustom org-select-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1543 "Non-nil means, after creating an agenda, move cursor into Agenda window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1544 When nil, cursor will remain in the current window."
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1545 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1546 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1547
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1548 (defcustom org-fit-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1549 "Non-nil means, change window size of agenda to fit content."
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1550 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1551 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1552
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1553 (defgroup org-agenda-display nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1554 "Options concerning what to display initially in Agenda."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1555 :tag "Org Agenda Display"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1556 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1557
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1558 (defcustom org-agenda-show-all-dates t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1559 "Non-nil means, `org-agenda' shows every day in the selected range.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1560 When nil, only the days which actually have entries are shown."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1561 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1562 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1563
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1564 (defcustom org-agenda-start-on-weekday 1
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1565 "Non-nil means, start the overview always on the specified weekday.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1566 0 denotes Sunday, 1 denotes Monday etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1567 When nil, always start on the current day."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1568 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1569 :type '(choice (const :tag "Today" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1570 (number :tag "Weekday No.")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1571
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1572 (defcustom org-agenda-ndays 7
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1573 "Number of days to include in overview display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1574 Should be 1 or 7."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1575 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1576 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1577
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1578 (defcustom org-agenda-use-time-grid t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1579 "Non-nil means, show a time grid in the agenda schedule.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1580 A time grid is a set of lines for specific times (like every two hours between
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1581 8:00 and 20:00). The items scheduled for a day at specific times are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1582 sorted in between these lines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1583 For details about when the grid will be shown, and what it will look like, see
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1584 the variable `org-agenda-time-grid'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1585 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1586 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1587
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1588 (defcustom org-agenda-time-grid
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1589 '((daily today require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1590 "----------------"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1591 (800 1000 1200 1400 1600 1800 2000))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1592
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1593 "The settings for time grid for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1594 This is a list of three items. The first item is again a list. It contains
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1595 symbols specifying conditions when the grid should be displayed:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1596
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1597 daily if the agenda shows a single day
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1598 weekly if the agenda shows an entire week
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1599 today show grid on current date, independent of daily/weekly display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1600 require-timed show grid only if at least on item has a time specification
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1601
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1602 The second item is a string which will be places behing the grid time.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1603
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1604 The third item is a list of integers, indicating the times that should have
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1605 a grid line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1606 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1607 :type
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1608 '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1609 (set :greedy t :tag "Grid Display Options"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1610 (const :tag "Show grid in single day agenda display" daily)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1611 (const :tag "Show grid in weekly agenda display" weekly)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1612 (const :tag "Always show grid for today" today)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1613 (const :tag "Show grid only if any timed entries are present"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1614 require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1615 (const :tag "Skip grid times already present in an entry"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1616 remove-match))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1617 (string :tag "Grid String")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1618 (repeat :tag "Grid Times" (integer :tag "Time"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1619
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1620 (defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1621 "Sorting structure for the agenda items of a single day.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1622 This is a list of symbols which will be used in sequence to determine
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1623 if an entry should be listed before another entry. The following
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1624 symbols are recognized:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1625
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1626 time-up Put entries with time-of-day indications first, early first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1627 time-down Put entries with time-of-day indications first, late first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1628 category-keep Keep the default order of categories, corresponding to the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1629 sequence in `org-agenda-files'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1630 category-up Sort alphabetically by category, A-Z.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1631 category-down Sort alphabetically by category, Z-A.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1632 priority-up Sort numerically by priority, high priority last.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1633 priority-down Sort numerically by priority, high priority first.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1634
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1635 The different possibilities will be tried in sequence, and testing stops
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1636 if one comparison returns a \"not-equal\". For example, the default
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1637 '(time-up category-keep priority-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1638 means: Pull out all entries having a specified time of day and sort them,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1639 in order to make a time schedule for the current day the first thing in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1640 agenda listing for the day. Of the entries without a time indication, keep
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1641 the grouped in categories, don't sort the categories, but keep them in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1642 the sequence given in `org-agenda-files'. Within each category sort by
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1643 priority.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1644
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1645 Leaving out `category-keep' would mean that items will be sorted across
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1646 categories by priority."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1647 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1648 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1649 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1650 (const time-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1651 (const time-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1652 (const category-keep)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1653 (const category-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1654 (const category-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1655 (const priority-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1656 (const priority-down))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1657
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1658 (defcustom org-sort-agenda-notime-is-late t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1659 "Non-nil means, items without time are considered late.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1660 This is only relevant for sorting. When t, items which have no explicit
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
1661 time like 15:30 will be considered as 99:01, i.e. later than any items which
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1662 do have a time. When nil, the default time is before 0:00. You can use this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1663 option to decide if the schedule for today should come before or after timeless
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1664 agenda entries."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1665 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1666 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1667
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1668
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1669 (defgroup org-agenda-prefix nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1670 "Options concerning the entry prefix in the Org-mode agenda display."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1671 :tag "Org Agenda Prefix"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1672 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1673
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1674 (defcustom org-agenda-prefix-format " %-12:c%?-12t% s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1675 "Format specification for the prefix of items in the agenda buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1676 This format works similar to a printf format, with the following meaning:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1677
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1678 %c the category of the item, \"Diary\" for entries from the diary, or
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1679 as given by the CATEGORY keyword or derived from the file name.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1680 %T the first tag of the item.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1681 %t the time-of-day specification if one applies to the entry, in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1682 format HH:MM
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1683 %s Scheduling/Deadline information, a short string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1684
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1685 All specifiers work basically like the standard `%s' of printf, but may
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1686 contain two additional characters: A question mark just after the `%' and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1687 a whitespace/punctuation character just before the final letter.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1688
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1689 If the first character after `%' is a question mark, the entire field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1690 will only be included if the corresponding value applies to the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1691 current entry. This is useful for fields which should have fixed
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1692 width when present, but zero width when absent. For example,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1693 \"%?-12t\" will result in a 12 character time field if a time of the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1694 day is specified, but will completely disappear in entries which do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1695 not contain a time.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1696
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1697 If there is punctuation or whitespace character just before the final
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1698 format letter, this character will be appended to the field value if
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1699 the value is not empty. For example, the format \"%-12:c\" leads to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1700 \"Diary: \" if the category is \"Diary\". If the category were be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1701 empty, no additional colon would be interted.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1702
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1703 The default value of this option is \" %-12:c%?-12t% s\", meaning:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1704 - Indent the line with two space characters
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1705 - Give the category in a 12 chars wide field, padded with whitespace on
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1706 the right (because of `-'). Append a colon if there is a category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1707 (because of `:').
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1708 - If there is a time-of-day, put it into a 12 chars wide field. If no
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1709 time, don't put in an empty field, just skip it (because of '?').
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1710 - Finally, put the scheduling information and append a whitespace.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1711
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1712 As another example, if you don't want the time-of-day of entries in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1713 the prefix, you could use:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1714
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1715 (setq org-agenda-prefix-format \" %-11:c% s\")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1716
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1717 See also the variables `org-agenda-remove-times-when-in-prefix' and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1718 `org-agenda-remove-tags-when-in-prefix'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1719 :type 'string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1720 :group 'org-agenda-prefix)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1721
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1722 (defvar org-prefix-format-compiled nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1723 "The compiled version of the most recently used prefix format.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1724 Depending on which command was used last, this may be the compiled version
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1725 of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1726
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1727 (defcustom org-agenda-remove-times-when-in-prefix t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1728 "Non-nil means, remove duplicate time specifications in agenda items.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1729 When the format `org-agenda-prefix-format' contains a `%t' specifier, a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1730 time-of-day specification in a headline or diary entry is extracted and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1731 placed into the prefix. If this option is non-nil, the original specification
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1732 \(a timestamp or -range, or just a plain time(range) specification like
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1733 11:30-4pm) will be removed for agenda display. This makes the agenda less
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1734 cluttered.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1735 The option can be t or nil. It may also be the symbol `beg', indicating
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1736 that the time should only be removed what it is located at the beginning of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1737 the headline/diary entry."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1738 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1739 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1740 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1741 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1742 (const :tag "When at beginning of entry" beg)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1743
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1744 (defcustom org-agenda-remove-tags-when-in-prefix nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1745 "Non-nil means, remove the tags from the headline copy in the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1746 When this is the symbol `prefix', only remove tags when
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1747 `org-agenda-prefix-format' contains a `%T' specifier."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1748 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1749 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1750 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1751 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1752 (const :tag "When prefix format contains %T" prefix)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1753
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1754 (defgroup org-agenda-timeline nil
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1755 "Options concerning the timeline buffer in Org Mode."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1756 :tag "Org Agenda Timeline"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1757 :group 'org-agenda)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1758
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1759 (defcustom org-timeline-prefix-format " % s"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1760 "Like `org-agenda-prefix-format', but for the timeline of a single file."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1761 :type 'string
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1762 :group 'org-agenda-timeline)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1763
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1764 (defcustom org-select-timeline-window t
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1765 "Non-nil means, after creating a timeline, move cursor into Timeline window.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1766 When nil, cursor will remain in the current window."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1767 :group 'org-agenda-timeline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1768 :type 'boolean)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1769
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1770 (defcustom org-timeline-show-empty-dates 3
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1771 "Non-nil means, `org-timeline' also shows dates without an entry.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1772 When nil, only the days which actually have entries are shown.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1773 When t, all days between the first and the last date are shown.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1774 When an integer, show also empty dates, but if there is a gap of more than
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1775 N days, just insert a special line indicating the size of the gap."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1776 :group 'org-agenda-timeline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1777 :type '(choice
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1778 (const :tag "None" nil)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1779 (const :tag "All" t)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1780 (number :tag "at most")))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
1781
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1782 (defgroup org-latex nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1783 "Options for embedding LaTeX code into Org-mode"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1784 :tag "Org LaTeX"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1785 :group 'org)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1786
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1787 (defcustom org-format-latex-options
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1788 '(:foreground "Black" :background "Transparent" :scale 1.0
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1789 :matchers ("begin" "$" "$$" "\\(" "\\["))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1790 "Options for creating images from LaTeX fragments.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1791 This is a property list with the following properties:
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1792 :foreground the foreground color, for example \"Black\".
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1793 :background the background color, or \"Transparent\".
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1794 :scale a scaling factor for the size of the images
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1795 :matchers a list indicating which matchers should be used to
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1796 find LaTeX fragments. Valid members of this list are:
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1797 \"begin\" find environments
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
1798 \"$\" find math expressions surrounded by $...$
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1799 \"$$\" find math expressions surrounded by $$....$$
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
1800 \"\\(\" find math expressions surrounded by \\(...\\)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
1801 \"\\ [\" find math expressions surrounded by \\ [...\\]"
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1802 :group 'org-latex
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1803 :type 'plist)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1804
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 (defgroup org-export nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806 "Options for exporting org-listings."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 :tag "Org Export"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1810 (defgroup org-export-general nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1811 "General options for exporting Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1812 :tag "Org Export General"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1813 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1814
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1815 (defcustom org-export-publishing-directory "."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1816 "Path to the location where exported files should be located.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1817 This path may be relative to the directory where the Org-mode file lives.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1818 The default is to put them into the same directory as the Org-mode file.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1819 The variable may also be an alist with export types `:html', `:ascii',
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1820 `:ical', or `:xoxo' and the corresponding directories. If a direcoty path
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1821 is relative, it is interpreted relative to the directory where the exported
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1822 Org-mode files lives."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1823 :group 'org-export-general
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1824 :type '(choice
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1825 (directory)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1826 (repeat
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1827 (cons
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1828 (choice :tag "Type"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1829 (const :html) (const :ascii) (const :ical) (const :xoxo))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1830 (directory)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1831
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (defcustom org-export-language-setup
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 '(("en" "Author" "Date" "Table of Contents")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 ("da" "Ophavsmand" "Dato" "Indhold")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 ("de" "Autor" "Datum" "Inhaltsverzeichnis")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 ("es" "Autor" "Fecha" "\xccndice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 ("fr" "Auteur" "Date" "Table des Mati\xe8res")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 ("it" "Autore" "Data" "Indice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 ("nl" "Auteur" "Datum" "Inhoudsopgave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840 ("nn" "Forfattar" "Dato" "Innhold") ;; nn = Norsk (nynorsk)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 ("sv" "F\xf6rfattarens" "Datum" "Inneh\xe5ll"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 "Terms used in export text, translated to different languages.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 Use the variable `org-export-default-language' to set the language,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 or use the +OPTION lines for a per-file setting."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1845 :group 'org-export-general
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1847 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1848 (string :tag "HTML language tag")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1849 (string :tag "Author")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1850 (string :tag "Date")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1851 (string :tag "Table of Contents"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853 (defcustom org-export-default-language "en"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 "The default language of HTML export, as a string.
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1855 This should have an association in `org-export-language-setup'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1856 :group 'org-export-general
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1857 :type 'string)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1858
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1859 (defcustom org-export-headline-levels 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1860 "The last level which is still exported as a headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1861 Inferior levels will produce itemize lists when exported.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1862 Note that a numeric prefix argument to an exporter function overrides
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1863 this setting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1864
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1865 This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1866 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1867 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1868
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1869 (defcustom org-export-with-section-numbers t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1870 "Non-nil means, add section numbers to headlines when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1871
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1872 This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1873 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1874 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1875
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1876 (defcustom org-export-with-toc t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1877 "Non-nil means, create a table of contents in exported files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1878 The TOC contains headlines with levels up to`org-export-headline-levels'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1879
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1880 Headlines which contain any TODO items will be marked with \"(*)\" in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1881 ASCII export, and with red color in HTML output.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1882
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1883 In HTML output, the TOC will be clickable.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1884
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1885 This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1886 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1887 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1888
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1889 (defcustom org-export-mark-todo-in-toc nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1890 "Non-nil means, mark TOC lines that contain any open TODO items."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1891 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1892 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1893
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1894 (defcustom org-export-preserve-breaks nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1895 "Non-nil means, preserve all line breaks when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1896 Normally, in HTML output paragraphs will be reformatted. In ASCII
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1897 export, line breaks will always be preserved, regardless of this variable.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1898
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1899 This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1900 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1901 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1902
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1903 (defcustom org-export-with-archived-trees 'headline
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1904 "Whether subtrees with the ARCHIVE tag should be exported.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1905 This can have three different values
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1906 nil Do not export, pretend this tree is not present
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1907 t Do export the entire tree
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1908 headline Only export the headline, but skip the tree below it."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1909 :group 'org-export-general
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1910 :group 'org-archive
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1911 :type '(choice
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1912 (const :tag "not at all" nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1913 (const :tag "headline only" 'headline)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1914 (const :tag "entirely" t)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1915
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1916 (defcustom org-export-with-timestamps t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1917 "Nil means, do not export time stamps and associated keywords."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1918 :group 'org-export
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1919 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1920
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
1921 (defcustom org-export-remove-timestamps-from-toc t
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
1922 "Nil means, remove timestamps from the table of contents entries."
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
1923 :group 'org-export
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
1924 :type 'boolean)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
1925
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1926 (defcustom org-export-with-tags t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1927 "Nil means, do not export tags, just remove them from headlines."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1928 :group 'org-export-general
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1929 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1930
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1931 (defcustom org-export-with-timestamps t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1932 "Nil means, do not export timestamps and associated keywords."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1933 :group 'org-export-general
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1934 :type 'boolean)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
1935
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1936 (defgroup org-export-translation nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1937 "Options for translating special ascii sequences for the export backends."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1938 :tag "Org Export Translation"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1939 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1940
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1941 (defcustom org-export-with-emphasize t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1942 "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1943 If the export target supports emphasizing text, the word will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1944 typeset in bold, italic, or underlined, respectively. Works only for
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1945 single words, but you can say: I *really* *mean* *this*.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1946 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1947
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1948 This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1949 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1950 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1951
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1952 (defcustom org-export-with-sub-superscripts t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1953 "Non-nil means, interpret \"_\" and \"^\" for export.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1954 When this option is turned on, you can use TeX-like syntax for sub- and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1955 superscripts. Several characters after \"_\" or \"^\" will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1956 considered as a single item - so grouping with {} is normally not
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1957 needed. For example, the following things will be parsed as single
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1958 sub- or superscripts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1959
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1960 10^24 or 10^tau several digits will be considered 1 item.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1961 10^-12 or 10^-tau a leading sign with digits or a word
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1962 x^2-y^3 will be read as x^2 - y^3, because items are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1963 terminated by almost any nonword/nondigit char.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1964 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1965
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1966 Still, ambiguity is possible - so when in doubt use {} to enclose the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1967 sub/superscript.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1968 Not all export backends support this, but HTML does.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1969
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1970 This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1971 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1972 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1973
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1974 (defcustom org-export-with-TeX-macros t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1975 "Non-nil means, interpret simple TeX-like macros when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1976 For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1977 No only real TeX macros will work here, but the standard HTML entities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1978 for math can be used as macro names as well. For a list of supported
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1979 names in HTML export, see the constant `org-html-entities'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1980 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1981
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1982 This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1983 :group 'org-export-translation
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1984 :group 'org-latex
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1985 :type 'boolean)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1986
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1987 (defcustom org-export-with-LaTeX-fragments nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1988 "Non-nil means, convert LaTeX fragments to images when exporting to HTML.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1989 When set, the exporter will find LaTeX environments if the \\begin line is
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1990 the first non-white thing on a line. It will also find the math delimiters
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1991 like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1992 display math.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1993
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1994 This option can also be set with the +OPTIONS line, e.g. \"LaTeX:t\"."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1995 :group 'org-export-translation
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
1996 :group 'org-latex
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1997 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1998
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1999 (defcustom org-export-with-fixed-width t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2000 "Non-nil means, lines starting with \":\" will be in fixed width font.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2001 This can be used to have pre-formatted text, fragments of code etc. For
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2002 example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2003 : ;; Some Lisp examples
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2004 : (while (defc cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2005 : (ding))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2006 will be looking just like this in also HTML. See also the QUOTE keyword.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2007 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2008
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2009 This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2010 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2011 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2012
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2013 (defcustom org-match-sexp-depth 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2014 "Number of stacked braces for sub/superscript matching.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2015 This has to be set before loading org.el to be effective."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2016 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2017 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2018
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2019 (defgroup org-export-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2020 "Options for exporting tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2021 :tag "Org Export Tables"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2022 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2023
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2024 (defcustom org-export-with-tables t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2025 "If non-nil, lines starting with \"|\" define a table.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2026 For example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2027
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2028 | Name | Address | Birthday |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2029 |-------------+----------+-----------|
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2030 | Arthur Dent | England | 29.2.2100 |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2031
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2032 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2033
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2034 This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2035 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2036 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2037
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2038 (defcustom org-export-highlight-first-table-line t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2039 "Non-nil means, highlight the first table line.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2040 In HTML export, this means use <th> instead of <td>.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2041 In tables created with table.el, this applies to the first table line.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2042 In Org-mode tables, all lines before the first horizontal separator
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2043 line will be formatted with <th> tags."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2044 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2045 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2046
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2047 (defcustom org-export-table-remove-special-lines t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2048 "Remove special lines and marking characters in calculating tables.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2049 This removes the special marking character column from tables that are set
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2050 up for spreadsheet calculations. It also removes the entire lines
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2051 marked with `!', `_', or `^'. The lines with `$' are kept, because
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2052 the values of constants may be useful to have."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2053 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2054 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2055
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2056 (defcustom org-export-prefer-native-exporter-for-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2057 "Non-nil means, always export tables created with table.el natively.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2058 Natively means, use the HTML code generator in table.el.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2059 When nil, Org-mode's own HTML generator is used when possible (i.e. if
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2060 the table does not use row- or column-spanning). This has the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2061 advantage, that the automatic HTML conversions for math symbols and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2062 sub/superscripts can be applied. Org-mode's HTML generator is also
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2063 much faster."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2064 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2065 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2066
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2067 (defgroup org-export-ascii nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2068 "Options specific for ASCII export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2069 :tag "Org Export ASCII"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2070 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2071
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2072 (defcustom org-export-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2073 "Characters for underlining headings in ASCII export.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2074 In the given sequence, these characters will be used for level 1, 2, ..."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2075 :group 'org-export-ascii
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2076 :type '(repeat character))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2077
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2078 (defcustom org-export-ascii-bullets '(?* ?+ ?-)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2079 "Bullet characters for headlines converted to lists in ASCII export.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2080 The first character is is used for the first lest level generated in this
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2081 way, and so on. If there are more levels than characters given here,
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2082 the list will be repeated.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2083 Note that plain lists will keep the same bullets as the have in the
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2084 Org-mode file."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2085 :group 'org-export-ascii
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2086 :type '(repeat character))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2087
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2088 (defcustom org-export-ascii-show-new-buffer t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2089 "Non-nil means, popup buffer containing the exported ASCII text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2090 Otherwise the buffer will just be saved to a file and stay hidden."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2091 :group 'org-export-ascii
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2092 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2093
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2094 (defgroup org-export-xml nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2095 "Options specific for XML export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2096 :tag "Org Export XML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2097 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2098
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2099 (defgroup org-export-html nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2100 "Options specific for HTML export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2101 :tag "Org Export HTML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2102 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2103
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2104 (defcustom org-export-html-style
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2105 "<style type=\"text/css\">
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2106 html {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2107 font-family: Times, serif;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2108 font-size: 12pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2109 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2110 .title { text-align: center; }
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2111 .todo { color: red; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2112 .done { color: green; }
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2113 .timestamp { color: grey }
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2114 .timestamp-kwd { color: CadetBlue }
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2115 .tag { background-color:lightblue; font-weight:normal }
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2116 .target { background-color: lavender; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2117 pre {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2118 border: 1pt solid #AEBDCC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2119 background-color: #F3F5F7;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2120 padding: 5pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2121 font-family: courier, monospace;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2122 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2123 table { border-collapse: collapse; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2124 td, th {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2125 vertical-align: top;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2126 border: 1pt solid #ADB9CC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2127 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2128 </style>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2129 "The default style specification for exported HTML files.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2130 Since there are different ways of setting style information, this variable
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2131 needs to contain the full HTML structure to provide a style, including the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2132 surrounding HTML tags. The style specifications should include definitions
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2133 for new classes todo, done, title, and deadline. For example, legal values
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2134 would be:
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2135
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2136 <style type=\"text/css\">
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2137 p { font-weight: normal; color: gray; }
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2138 h1 { color: black; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2139 .title { text-align: center; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2140 .todo, .deadline { color: red; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2141 .done { color: green; }
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2142 </style>
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2143
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2144 or, if you want to keep the style in a file,
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2145
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2146 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2147
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2148 As the value of this option simply gets inserted into the HTML <head> header,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
2149 you can \"misuse\" it to add arbitrary text to the header."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2150 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2151 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2152
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2153 (defcustom org-export-html-link-org-files-as-html t
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2154 "Non-nil means, make file links to `file.org' point to `file.html'.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2155 When org-mode is exporting an org-mode file to HTML, links to
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2156 non-html files are directly put into a href tag in HTML.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2157 However, links to other Org-mode files (recognized by the
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2158 extension `.org.) should become links to the corresponding html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2159 file, assuming that the linked org-mode file will also be
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2160 converted to HTML.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2161 When nil, the links still point to the plain `.org' file."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2162 :group 'org-export-html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2163 :type 'boolean)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2164
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2165 (defcustom org-export-html-inline-images 'maybe
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2166 "Non-nil means, inline images into exported HTML pages.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2167 This is done using an <img> tag. When nil, an anchor with href is used to
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2168 link to the image. If this option is `maybe', then images in links with
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2169 an empty description will be inlined, while images with a description will
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2170 be linked only."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2171 :group 'org-export-html
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2172 :type '(choice (const :tag "Never" nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2173 (const :tag "Always" t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2174 (const :tag "When there is no description" maybe)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2175
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2176 (defcustom org-export-html-expand t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2177 "Non-nil means, for HTML export, treat @<...> as HTML tag.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2178 When nil, these tags will be exported as plain text and therefore
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 not be interpreted by a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2180
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2181 This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2182 :group 'org-export-html
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
2183 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
2184
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 (defcustom org-export-html-table-tag
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2186 "<table border=\"1\" cellspacing=\"0\" cellpadding=\"6\">"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 "The HTML tag used to start a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188 This must be a <table> tag, but you may change the options like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 borders and spacing."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2190 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 (defcustom org-export-html-with-timestamp nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2194 "If non-nil, write `org-export-html-html-helper-timestamp'
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2195 into the exported HTML text. Otherwise, the buffer will just be saved
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 to a file."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2197 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2198 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 (defcustom org-export-html-html-helper-timestamp
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2201 "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2202 "The HTML tag used as timestamp delimiter for HTML-helper-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2203 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 (defcustom org-export-html-show-new-buffer nil
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2207 "Non-nil means, popup buffer containing the exported html text.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 Otherwise, the buffer will just be saved to a file and stay hidden."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2209 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2212 (defgroup org-export-icalendar nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2213 "Options specific for iCalendar export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2214 :tag "Org Export iCalendar"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2215 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2216
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2217 (defcustom org-combined-agenda-icalendar-file "~/org.ics"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2218 "The file name for the iCalendar file covering all agenda files.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2219 This file is created with the command \\[org-export-icalendar-all-agenda-files].
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2220 The file name should be absolute."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2221 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2222 :type 'file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2223
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2224 (defcustom org-icalendar-include-todo nil
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2225 "Non-nil means, export to iCalendar files should also cover TODO items."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2226 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2227 :type 'boolean)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2228
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2229 (defcustom org-icalendar-combined-name "OrgMode"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2230 "Calendar name for the combined iCalendar representing all agenda files."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2231 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2232 :type 'string)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
2233
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2234 (defgroup org-font-lock nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2235 "Font-lock settings for highlighting in Org-mode."
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2236 :tag "Org Font Lock"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2238
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2239 (defcustom org-level-color-stars-only nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2240 "Non-nil means fontify only the stars in each headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2241 When nil, the entire headline is fontified.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2242 Changing it requires restart of `font-lock-mode' to become effective
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2243 also in regions already fontified."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2244 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2245 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2246
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2247 (defcustom org-hide-leading-stars nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2248 "Non-nil means, hide the first N-1 stars in a headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2249 This works by using the face `org-hide' for these stars. This
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2250 face is white for a light background, and black for a dark
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2251 background. You may have to customize the face `org-hide' to
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2252 make this work.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2253 Changing it requires restart of `font-lock-mode' to become effective
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2254 also in regions already fontified.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2255 You may also set this on a per-file basis by adding one of the following
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2256 lines to the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2257
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2258 #+STARTUP: hidestars
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2259 #+STARTUP: showstars"
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2260 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2261 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2262
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2263 (defcustom org-fontify-done-headline nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2264 "Non-nil means, change the face of a headline if it is marked DONE.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2265 Normally, only the TODO/DONE keyword indicates the state of a headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2266 When this is non-nil, the headline after the keyword is set to the
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2267 `org-headline-done' as an additional indication."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2268 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2269 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2270
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2271 (defcustom org-fontify-emphasized-text t
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2272 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2273 Changing this variable requires a restart of Emacs to take effect."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2274 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2275 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2276
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2277 (defvar org-emph-re nil
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2278 "Regular expression for matching emphasis.")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2279 (defvar org-emphasis-regexp-components) ; defined just below
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2280 (defvar org-emphasis-alist) ; defined just below
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2281 (defun org-set-emph-re (var val)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2282 "Set variable and compute the emphasis regular expression."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2283 (set var val)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2284 (when (and (boundp 'org-emphasis-alist)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2285 (boundp 'org-emphasis-regexp-components)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2286 org-emphasis-alist org-emphasis-regexp-components)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2287 (let* ((e org-emphasis-regexp-components)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2288 (pre (car e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2289 (post (nth 1 e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2290 (border (nth 2 e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2291 (body (nth 3 e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2292 (nl (nth 4 e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2293 (stacked (nth 5 e))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2294 (body1 (concat body "*?"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2295 (markers (mapconcat 'car org-emphasis-alist "")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2296 ;; make sure special characters appear at the right position in the class
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2297 (if (string-match "\\^" markers)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2298 (setq markers (concat (replace-match "" t t markers) "^")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2299 (if (string-match "-" markers)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2300 (setq markers (concat (replace-match "" t t markers) "-")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2301 (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\n?" body "*?")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2302 ;; Make the regexp
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2303 (setq org-emph-re
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2304 (concat "\\([" pre (if stacked markers) "]\\|^\\)"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2305 "\\("
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2306 "\\([" markers "]\\)"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2307 "\\("
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2308 "[^" border markers "]"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2309 body1
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2310 "[^" border markers "]"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2311 "\\)"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2312 "\\3\\)"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2313 "\\([" post (if stacked markers) "]\\|$\\)")))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2314
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2315 (defcustom org-emphasis-regexp-components
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2316 '(" \t(" " \t.,?;:'\")" " \t\r\n,." "." 1 nil)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2317 "Components used to build the reqular expression for emphasis.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2318 This is a list with 6 entries. Terminology: In an emphasis string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2319 like \" *strong word* \", we call the initial space PREMATCH, the final
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2320 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2321 and \"trong wor\" is the body. The different components in this variable
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2322 specify what is allowed/forbidden in each part:
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2323
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2324 pre Chars allowed as prematch. Beginning of line will be allowed too.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2325 post Chars allowed as postmatch. End of line will be allowed too.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2326 border The chars *forbidden* as border characters. In addition to the
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2327 characters given here, all marker characters are forbidden too.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2328 body-regexp A regexp like \".\" to match a body character. Don't use
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2329 non-shy groups here, and don't allow newline here.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2330 newline The maximum number of newlines allowed in an emphasis exp.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2331 stacked Non-nil means, allow stacked styles. This works only in HTML
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2332 export. When this is set, all marker characters (as given in
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2333 `org-emphasis-alist') will be allowed as pre/post, aiding
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2334 inside-out matching.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2335 Use customize to modify this, or restart emacs after changing it."
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2336 :group 'org-font-lock
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2337 :set 'org-set-emph-re
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2338 :type '(list
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2339 (sexp :tag "Allowed chars in pre ")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2340 (sexp :tag "Allowed chars in post ")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2341 (sexp :tag "Forbidden chars in border ")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2342 (sexp :tag "Regexp for body ")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2343 (integer :tag "number of newlines allowed")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2344 (boolean :tag "Stacking allowed ")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2345
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2346 (defcustom org-emphasis-alist
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2347 '(("*" bold "<b>" "</b>")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2348 ("/" italic "<i>" "</i>")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2349 ("_" underline "<u>" "</u>")
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2350 ("=" shadow "<code>" "</code>")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2351 ("+" (:strike-through t) "<del>" "</del>")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2352 )
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2353 "Special syntax for emphasised text.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2354 Text starting and ending with a special character will be emphasized, for
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2355 example *bold*, _underlined_ and /italic/. This variable sets the marker
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2356 characters, the face to bbe used by font-lock for highlighting in Org-mode
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2357 emacs buffers, and the HTML tags to be used for this.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2358 Use customize to modify this, or restart emacs after changing it."
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2359 :group 'org-font-lock
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2360 :set 'org-set-emph-re
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2361 :type '(repeat
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2362 (list
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2363 (string :tag "Marker character")
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2364 (choice
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2365 (face :tag "Font-lock-face")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2366 (plist :tag "Face property list"))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2367 (string :tag "HTML start tag")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2368 (string :tag "HTML end tag"))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2369
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2370 (defgroup org-faces nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2371 "Faces in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2372 :tag "Org Faces"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2373 :group 'org-font-lock)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2374
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2375 (defun org-compatible-face (specs)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2376 "Make a compatible face specification.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2377 XEmacs and Emacs 21 do not know about the `min-colors' attribute.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2378 For them we convert a (min-colors 8) entry to a `tty' entry and move it
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2379 to the top of the list. The `min-colors' attribute will be removed from
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2380 any other entries, and any resulting duplicates will be removed entirely."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2381 (if (or (featurep 'xemacs) (< emacs-major-version 22))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2382 (let (r e a)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2383 (while (setq e (pop specs))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2384 (cond
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2385 ((memq (car e) '(t default)) (push e r))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2386 ((setq a (member '(min-colors 8) (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2387 (nconc r (list (cons (cons '(type tty) (delq (car a) (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2388 (cdr e)))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2389 ((setq a (assq 'min-colors (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2390 (setq e (cons (delq a (car e)) (cdr e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2391 (or (assoc (car e) r) (push e r)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2392 (t (or (assoc (car e) r) (push e r)))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2393 (nreverse r))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2394 specs))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2395
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2396 (defface org-hide
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2397 '((((background light)) (:foreground "white"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2398 (((background dark)) (:foreground "black")))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2399 "Face used to hide leading stars in headlines.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2400 The forground color of this face should be equal to the background
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2401 color of the frame."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2402 :group 'org-faces)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2403
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2404 (defface org-level-1 ;; font-lock-function-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2405 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2406 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2407 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2408 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2409 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2410 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2411 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 "Face used for level 1 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2413 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2414
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2415 (defface org-level-2 ;; font-lock-variable-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2416 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2417 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2418 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2419 (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2420 (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2421 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2422 "Face used for level 2 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2423 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2424
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2425 (defface org-level-3 ;; font-lock-keyword-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2426 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2427 '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2428 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2429 (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2430 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2431 (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2432 (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2433 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2434 "Face used for level 3 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2435 :group 'org-faces)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2436
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2437 (defface org-level-4 ;; font-lock-comment-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2438 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2439 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2440 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2441 (((class color) (min-colors 16) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2442 (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2443 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2444 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2445 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2446 "Face used for level 4 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2447 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2448
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2449 (defface org-level-5 ;; font-lock-type-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2450 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2451 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2452 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2453 (((class color) (min-colors 8)) (:foreground "green"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2454 "Face used for level 5 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2455 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2456
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2457 (defface org-level-6 ;; font-lock-constant-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2458 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2459 '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2460 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2461 (((class color) (min-colors 8)) (:foreground "magenta"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2462 "Face used for level 6 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2463 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2464
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2465 (defface org-level-7 ;; font-lock-builtin-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2466 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2467 '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2468 (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2469 (((class color) (min-colors 8)) (:foreground "blue"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2470 "Face used for level 7 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2471 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2472
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2473 (defface org-level-8 ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2474 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2475 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2476 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2477 (((class color) (min-colors 8)) (:foreground "green"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2478 "Face used for level 8 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2479 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2480
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2481 (defface org-special-keyword ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2482 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2483 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2484 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2485 (t (:italic t))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2486 "Face used for special keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2487 :group 'org-faces)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2488
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2489 (defface org-warning ;; font-lock-warning-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2490 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2491 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2492 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2493 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2494 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2495 (t (:bold t))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2496 "Face for deadlines and TODO keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2497 :group 'org-faces)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2498
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2499 (defface org-headline-done ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2500 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2501 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2502 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2503 (((class color) (min-colors 8) (background light)) (:bold nil))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2504 "Face used to indicate that a headline is DONE.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2505 This face is only used if `org-fontify-done-headline' is set."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2506 :group 'org-faces)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2507
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2508 (defface org-archived ; similar to shadow
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2509 (org-compatible-face
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2510 '((((class color grayscale) (min-colors 88) (background light))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2511 (:foreground "grey50"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2512 (((class color grayscale) (min-colors 88) (background dark))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2513 (:foreground "grey70"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2514 (((class color) (min-colors 8) (background light))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2515 (:foreground "green"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2516 (((class color) (min-colors 8) (background dark))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2517 (:foreground "yellow"))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2518 "Face for headline with the ARCHIVE tag."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2519 :group 'org-faces)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2520
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2521 (defface org-link
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2522 '((((class color) (background light)) (:foreground "Purple" :underline t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2523 (((class color) (background dark)) (:foreground "Cyan" :underline t))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2524 (t (:underline t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2525 "Face for links."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2526 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2527
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2528 (defface org-date
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2529 '((((class color) (background light)) (:foreground "Purple" :underline t))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2530 (((class color) (background dark)) (:foreground "Cyan" :underline t))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2531 (t (:underline t)))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2532 "Face for links."
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2533 :group 'org-faces)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2534
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2535 (defface org-tag
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2536 '((t (:bold t)))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2537 "Face for tags."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2538 :group 'org-faces)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2539
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2540 (defface org-todo ;; font-lock-warning-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2541 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2542 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2543 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2544 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2545 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2546 (t (:inverse-video t :bold t))))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2547 "Face for TODO keywords."
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2548 :group 'org-faces)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2549
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2550 (defface org-done ;; font-lock-type-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2551 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2552 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2553 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2554 (((class color) (min-colors 8)) (:foreground "green"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2555 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556 "Face used for DONE."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2557 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2558
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2559 (defface org-table ;; font-lock-function-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2560 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2561 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2562 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2563 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2564 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2565 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2566 (((class color) (min-colors 8) (background dark)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2567 "Face used for tables."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2568 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2569
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2570 (defface org-formula
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2571 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2572 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2573 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2574 (((class color) (min-colors 8) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2575 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2576 (t (:bold t :italic t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2577 "Face for formulas."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2578 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2579
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2580 (defface org-scheduled-today
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2581 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2582 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2583 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2584 (((class color) (min-colors 8)) (:foreground "green"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2585 (t (:bold t :italic t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2586 "Face for items scheduled for a certain day."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2587 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2588
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2589 (defface org-scheduled-previously
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2590 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2591 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2592 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2593 (((class color) (min-colors 8) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2594 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2595 (t (:bold t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2596 "Face for items scheduled previously, and not yet done."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2597 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2598
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2599 (defface org-upcoming-deadline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2600 (org-compatible-face
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2601 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2602 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2603 (((class color) (min-colors 8) (background light)) (:foreground "red"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2604 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2605 (t (:bold t))))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2606 "Face for items scheduled previously, and not yet done."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2607 :group 'org-faces)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2608
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2609 (defface org-time-grid ;; font-lock-variable-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2610 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2611 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2612 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2613 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2614 "Face used for time grids."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2615 :group 'org-faces)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2616
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2617 (defconst org-level-faces
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2618 '(org-level-1 org-level-2 org-level-3 org-level-4
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2619 org-level-5 org-level-6 org-level-7 org-level-8
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2620 ))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2621 (defconst org-n-levels (length org-level-faces))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2622
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2623
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2624 ;; Variables for pre-computed regular expressions, all buffer local
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2625 (defvar org-done-string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2626 "The last string in `org-todo-keywords', indicating an item is DONE.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2627 (make-variable-buffer-local 'org-done-string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2628 (defvar org-todo-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2629 "Matches any of the TODO state keywords.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2630 (make-variable-buffer-local 'org-todo-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2631 (defvar org-not-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2632 "Matches any of the TODO state keywords except the last one.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2633 (make-variable-buffer-local 'org-not-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2634 (defvar org-todo-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2635 "Matches a headline and puts TODO state into group 2 if present.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2636 (make-variable-buffer-local 'org-todo-line-regexp)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2637 (defvar org-todo-line-tags-regexp nil
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2638 "Matches a headline and puts TODO state into group 2 if present.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2639 Also put tags into group 4 if tags are present.")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2640 (make-variable-buffer-local 'org-todo-line-tags-regexp)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2641 (defvar org-nl-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2642 "Matches newline followed by a headline with the DONE keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2643 (make-variable-buffer-local 'org-nl-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2644 (defvar org-looking-at-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2645 "Matches the DONE keyword a point.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2646 (make-variable-buffer-local 'org-looking-at-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2647 (defvar org-todo-kwd-priority-p nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2648 "Do TODO items have priorities?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2649 (make-variable-buffer-local 'org-todo-kwd-priority-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2650 (defvar org-todo-kwd-max-priority nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2651 "Maximum priority of TODO items.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2652 (make-variable-buffer-local 'org-todo-kwd-max-priority)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2653 (defvar org-ds-keyword-length 12
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2654 "Maximum length of the Deadline and SCHEDULED keywords.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2655 (make-variable-buffer-local 'org-ds-keyword-length)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2656 (defvar org-deadline-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2657 "Matches the DEADLINE keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2658 (make-variable-buffer-local 'org-deadline-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2659 (defvar org-deadline-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2660 "Matches the DEADLINE keyword together with a time stamp.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2661 (make-variable-buffer-local 'org-deadline-time-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2662 (defvar org-deadline-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2663 "Matches the DEADLINE keyword and the rest of the line.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2664 (make-variable-buffer-local 'org-deadline-line-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2665 (defvar org-scheduled-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2666 "Matches the SCHEDULED keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2667 (make-variable-buffer-local 'org-scheduled-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2668 (defvar org-scheduled-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2669 "Matches the SCHEDULED keyword together with a time stamp.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2670 (make-variable-buffer-local 'org-scheduled-time-regexp)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2671 (defvar org-closed-time-regexp nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2672 "Matches the CLOSED keyword together with a time stamp.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2673 (make-variable-buffer-local 'org-closed-time-regexp)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2674
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2675 (defvar org-keyword-time-regexp nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2676 "Matches any of the 3 keywords, together with the time stamp.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2677 (make-variable-buffer-local 'org-keyword-time-regexp)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2678 (defvar org-maybe-keyword-time-regexp nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2679 "Matches a timestamp, possibly preceeded by a keyword.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2680 (make-variable-buffer-local 'org-keyword-time-regexp)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2681
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2682 (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2683 mouse-map t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2684 "Properties to remove when a string without properties is wanted.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2685
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2686 (defsubst org-match-string-no-properties (num &optional string)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2687 (if (featurep 'xemacs)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2688 (let ((s (match-string num string)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2689 (remove-text-properties 0 (length s) org-rm-props s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2690 s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2691 (match-string-no-properties num string)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2692
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2693 (defsubst org-no-properties (s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2694 (remove-text-properties 0 (length s) org-rm-props s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2695 s)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2696
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2697 (defsubst org-mode-p ()
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2698 "Check if the current buffer is in Org-mode."
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2699 (eq major-mode 'org-mode))
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2700
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2701 (defun org-set-regexps-and-options ()
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2702 "Precompute regular expressions for current buffer."
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2703 (when (org-mode-p)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2704 (let ((re (org-make-options-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2705 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2706 "STARTUP" "ARCHIVE" "TAGS")))
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2707 (splitre "[ \t]+")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2708 kwds int key value cat arch tags)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2709 (save-excursion
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2710 (save-restriction
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2711 (widen)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2712 (goto-char (point-min))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2713 (while (re-search-forward re nil t)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2714 (setq key (match-string 1) value (org-match-string-no-properties 2))
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2715 (cond
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2716 ((equal key "CATEGORY")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2717 (if (string-match "[ \t]+$" value)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2718 (setq value (replace-match "" t t value)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2719 (setq cat (intern value)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2720 ((equal key "SEQ_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2721 (setq int 'sequence
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2722 kwds (append kwds (org-split-string value splitre))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2723 ((equal key "PRI_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2724 (setq int 'priority
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2725 kwds (append kwds (org-split-string value splitre))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2726 ((equal key "TYP_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2727 (setq int 'type
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2728 kwds (append kwds (org-split-string value splitre))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2729 ((equal key "TAGS")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2730 (setq tags (append tags (org-split-string value splitre))))
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2731 ((equal key "STARTUP")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2732 (let ((opts (org-split-string value splitre))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2733 (set '(("fold" org-startup-folded t)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
2734 ("overview" org-startup-folded t)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2735 ("nofold" org-startup-folded nil)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
2736 ("showall" org-startup-folded nil)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2737 ("content" org-startup-folded content)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2738 ("hidestars" org-hide-leading-stars t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2739 ("showstars" org-hide-leading-stars nil)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2740 ("odd" org-odd-levels-only t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2741 ("oddeven" org-odd-levels-only nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2742 ("align" org-startup-align-all-tables t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2743 ("noalign" org-startup-align-all-tables nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2744 ("logging" org-log-done t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2745 ("nologging" org-log-done nil)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2746 ("dlcheck" org-startup-with-deadline-check t)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2747 ("nodlcheck" org-startup-with-deadline-check nil)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2748 l var val)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2749 (while (setq l (assoc (pop opts) set))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2750 (setq var (nth 1 l) val (nth 2 l))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2751 (set (make-local-variable var) val))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2752 ((equal key "ARCHIVE")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2753 (string-match " *$" value)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2754 (setq arch (replace-match "" t t value))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2755 (remove-text-properties 0 (length arch)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2756 '(face t fontified t) arch)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2757 )))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2758 (and cat (set (make-local-variable 'org-category) cat))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2759 (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2760 (and arch (set (make-local-variable 'org-archive-location) arch))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2761 (and int (set (make-local-variable 'org-todo-interpretation) int))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2762 (when tags
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2763 (let (e tgs)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2764 (while (setq e (pop tags))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2765 (cond
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2766 ((equal e "{") (push '(:startgroup) tgs))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2767 ((equal e "}") (push '(:endgroup) tgs))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2768 ((string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2769 (push (cons (match-string 1 e)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2770 (string-to-char (match-string 2 e)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2771 tgs))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2772 (t (push (list e) tgs))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2773 (set (make-local-variable 'org-tag-alist) nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2774 (while (setq e (pop tgs))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2775 (or (and (stringp (car e))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
2776 (assoc (car e) org-tag-alist))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2777 (push e org-tag-alist))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2778
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2779 ;; Compute the regular expressions and other local variables
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2780 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2781 org-todo-kwd-max-priority (1- (length org-todo-keywords))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2782 org-ds-keyword-length (+ 2 (max (length org-deadline-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2783 (length org-scheduled-string)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2784 org-done-string
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2785 (nth (1- (length org-todo-keywords)) org-todo-keywords)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2786 org-todo-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2787 (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2788 "\\|") "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2789 org-not-done-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2790 (concat "\\<\\("
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2791 (mapconcat 'regexp-quote
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2792 (nreverse (cdr (reverse org-todo-keywords)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2793 "\\|")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2794 "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2795 org-todo-line-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2796 (concat "^\\(\\*+\\)[ \t]*\\("
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2797 (mapconcat 'regexp-quote org-todo-keywords "\\|")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2798 "\\)? *\\(.*\\)")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2799 org-nl-done-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2800 (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2801 org-todo-line-tags-regexp
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2802 (concat "^\\(\\*+\\)[ \t]*\\("
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2803 (mapconcat 'regexp-quote org-todo-keywords "\\|")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
2804 "\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)")
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2805 org-looking-at-done-regexp (concat "^" org-done-string "\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2806 org-deadline-regexp (concat "\\<" org-deadline-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2807 org-deadline-time-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2808 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2809 org-deadline-line-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2810 (concat "\\<\\(" org-deadline-string "\\).*")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2811 org-scheduled-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2812 (concat "\\<" org-scheduled-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2813 org-scheduled-time-regexp
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2814 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2815 org-closed-time-regexp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2816 (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2817 org-keyword-time-regexp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2818 (concat "\\<\\(" org-scheduled-string
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2819 "\\|" org-deadline-string
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2820 "\\|" org-closed-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2821 "\\|" org-clock-string "\\)"
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
2822 " *[[<]\\([^]>]+\\)[]>]")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2823 org-maybe-keyword-time-regexp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2824 (concat "\\(\\<\\(" org-scheduled-string
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2825 "\\|" org-deadline-string
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2826 "\\|" org-closed-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2827 "\\|" org-clock-string "\\)\\)?"
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
2828 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2829
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2830 (org-set-font-lock-defaults)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2831
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2832 ;; Tell the compiler about dynamically scoped variables,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2833 ;; and variables from other packages
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
2834 (defvar calc-embedded-close-formula) ; defined by the calc package
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
2835 (defvar calc-embedded-open-formula) ; defined by the calc package
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
2836 (defvar font-lock-unfontify-region-function) ; defined by font-lock.el
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2837 (defvar zmacs-regions) ; XEmacs regions
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2838 (defvar original-date) ; dynamically scoped in calendar
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2839 (defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2840 (defvar orgtbl-mode-menu) ; defined when orgtbl mode get initialized
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2841 (defvar org-html-entities) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2842 (defvar org-goto-start-pos) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2843 (defvar org-time-was-given) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2844 (defvar org-ts-what) ; dynamically scoped parameter
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2845 (defvar org-current-export-file) ; dynamically scoped parameter
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
2846 (defvar org-current-export-dir) ; dynamically scoped parameter
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2847 (defvar mark-active) ; Emacs only, not available in XEmacs.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2848 (defvar timecnt) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2849 (defvar levels-open) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2850 (defvar entry) ; dynamically scoped parameter
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2851 (defvar state) ; dynamically scoped into `org-after-todo-state-change-hook'
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2852 (defvar date) ; dynamically scoped parameter
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2853 (defvar description) ; dynamically scoped parameter
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2854 (defvar ans1) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2855 (defvar ans2) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2856 (defvar starting-day) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2857 (defvar include-all-loc) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2858 (defvar vm-message-pointer) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2859 (defvar vm-folder-directory) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2860 (defvar wl-summary-buffer-elmo-folder) ; from wanderlust
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2861 (defvar wl-summary-buffer-folder-name) ; from wanderlust
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2862 (defvar gnus-group-name) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2863 (defvar gnus-article-current) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2864 (defvar w3m-current-url) ; from w3m
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2865 (defvar w3m-current-title) ; from w3m
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2866 (defvar mh-progs) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2867 (defvar mh-current-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2868 (defvar mh-show-folder-buffer) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2869 (defvar mh-index-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2870 (defvar mh-searcher) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2871 (defvar org-selected-point) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2872 (defvar calendar-mode-map) ; from calendar.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2873 (defvar last-arg) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2874 (defvar remember-save-after-remembering) ; from remember.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2875 (defvar remember-data-file) ; from remember.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2876 (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2877 (defvar initial) ; from remember.el, dynamically scoped in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2878 (defvar orgtbl-mode) ; defined later in this file
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2879 (defvar Info-current-file) ; from info.el
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2880 (defvar Info-current-node) ; from info.el
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
2881 (defvar texmathp-why) ; from texmathp.el
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
2882 (defvar org-latex-regexps)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2883
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2884 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2885
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2886 (defvar org-mode-map
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2887 (if (and (not (keymapp outline-mode-map)) (featurep 'allout))
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2888 (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.")
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2889 (copy-keymap outline-mode-map))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2890 "Keymap for Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2891
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2892 (defvar org-struct-menu) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2893 (defvar org-org-menu) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2894 (defvar org-tbl-menu) ; defined later in this file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2895
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2896 ;; We use a before-change function to check if a table might need
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2897 ;; an update.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2898 (defvar org-table-may-need-update t
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2899 "Indicates that a table might need an update.
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
2900 This variable is set by `org-before-change-function'.
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2901 `org-table-align' sets it back to nil.")
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2902 (defvar org-mode-hook nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2903 (defvar org-inhibit-startup nil) ; Dynamically-scoped param.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2904 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2905
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2906
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2907 ;;;###autoload
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2908 (define-derived-mode org-mode outline-mode "Org"
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2909 "Outline-based notes management and organizer, alias
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2910 \"Carsten's outline-mode for keeping track of everything.\"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2911
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2912 Org-mode develops organizational tasks around a NOTES file which
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2913 contains information about projects as plain text. Org-mode is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2914 implemented on top of outline-mode, which is ideal to keep the content
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2915 of large files well structured. It supports ToDo items, deadlines and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2916 time stamps, which magically appear in the diary listing of the Emacs
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2917 calendar. Tables are easily created with a built-in table editor.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2918 Plain text URL-like links connect to websites, emails (VM), Usenet
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2919 messages (Gnus), BBDB entries, and any files related to the project.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2920 For printing and sharing of notes, an Org-mode file (or a part of it)
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2921 can be exported as a structured ASCII or HTML file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2922
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2923 The following commands are available:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2924
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2925 \\{org-mode-map}"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2926
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2927 ;; Get rid of Outline menus, they are not needed
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2928 ;; Need to do this here because define-derived-mode sets up
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2929 ;; the keymap so late.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2930 (if (featurep 'xemacs)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2931 (if org-noutline-p
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2932 (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2933 (easy-menu-remove outline-mode-menu-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2934 (easy-menu-remove outline-mode-menu-show)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2935 (easy-menu-remove outline-mode-menu-hide))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2936 (delete-menu-item '("Headings"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2937 (delete-menu-item '("Show"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2938 (delete-menu-item '("Hide"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2939 (set-menubar-dirty-flag))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2940 (define-key org-mode-map [menu-bar headings] 'undefined)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2941 (define-key org-mode-map [menu-bar hide] 'undefined)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2942 (define-key org-mode-map [menu-bar show] 'undefined))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2943
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2944 (easy-menu-add org-org-menu)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2945 (easy-menu-add org-tbl-menu)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2946 (org-install-agenda-files-menu)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2947 (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2948 (org-add-to-invisibility-spec '(org-cwidth))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2949 (when (featurep 'xemacs)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2950 (set (make-local-variable 'line-move-ignore-invisible) t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2951 (setq outline-regexp "\\*+")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2952 ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2953 (setq outline-level 'org-outline-level)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2954 (when (and org-ellipsis (stringp org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2955 (unless org-display-table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2956 (setq org-display-table (make-display-table)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2957 (set-display-table-slot org-display-table
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2958 4 (string-to-vector org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2959 (setq buffer-display-table org-display-table))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2960 (org-set-regexps-and-options)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2961 (modify-syntax-entry ?# "<")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2962 (if org-startup-truncated (setq truncate-lines t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2963 (set (make-local-variable 'font-lock-unfontify-region-function)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2964 'org-unfontify-region)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2965 ;; Activate before-change-function
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2966 (set (make-local-variable 'org-table-may-need-update) t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2967 (org-add-hook 'before-change-functions 'org-before-change-function nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2968 'local)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2969 ;; Check for running clock before killing a buffer
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
2970 (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2971 ;; Paragraphs and auto-filling
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2972 (org-set-autofill-regexps)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2973 (org-update-radio-target-regexp)
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
2974
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2975 (if (and org-insert-mode-line-in-empty-file
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2976 (interactive-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2977 (= (point-min) (point-max)))
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2978 (insert " -*- mode: org -*-\n\n"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2979
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2980 (unless org-inhibit-startup
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2981 (when org-startup-align-all-tables
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2982 (let ((bmp (buffer-modified-p)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2983 (org-table-map-tables 'org-table-align)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
2984 (set-buffer-modified-p bmp)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2985 (if org-startup-with-deadline-check
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2986 (call-interactively 'org-check-deadlines)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2987 (cond
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2988 ((eq org-startup-folded t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2989 (org-cycle '(4)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2990 ((eq org-startup-folded 'content)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2991 (let ((this-command 'org-cycle) (last-command 'org-cycle))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2992 (org-cycle '(4)) (org-cycle '(4))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2993
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2994 (defsubst org-call-with-arg (command arg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2995 "Call COMMAND interactively, but pretend prefix are was ARG."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2996 (let ((current-prefix-arg arg)) (call-interactively command)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
2997
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2998 (defsubst org-current-line (&optional pos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2999 (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point)))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
3000
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3001 (defun org-current-time ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3002 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3003 (if (> org-time-stamp-rounding-minutes 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3004 (let ((r org-time-stamp-rounding-minutes)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3005 (time (decode-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3006 (apply 'encode-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3007 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3008 (nthcdr 2 time))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3009 (current-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3010
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3011 (defun org-add-props (string plist &rest props)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3012 "Add text properties to entire string, from beginning to end.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3013 PLIST may be a list of properties, PROPS are individual properties and values
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3014 that will be added to PLIST. Returns the string that was modified."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3015 (add-text-properties
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3016 0 (length string) (if props (append plist props) plist) string)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
3017 string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3018 (put 'org-add-props 'lisp-indent-function 2)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3019
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
3020
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3021 ;;; Font-Lock stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3022
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3023 (defvar org-mouse-map (make-sparse-keymap))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
3024 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3025 (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3026 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3027 (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
3028 (when org-mouse-1-follows-link
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
3029 (define-key org-mouse-map [follow-link] 'mouse-face))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3030 (when org-tab-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3031 (define-key org-mouse-map [(tab)] 'org-open-at-point)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3032 (define-key org-mouse-map "\C-i" 'org-open-at-point))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3033 (when org-return-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3034 (define-key org-mouse-map [(return)] 'org-open-at-point)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3035 (define-key org-mouse-map "\C-m" 'org-open-at-point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3036
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3037 (require 'font-lock)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3039 (defconst org-non-link-chars "]\t\n\r<>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3040 (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3041 "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3042 (defconst org-link-re-with-space
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3043 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3044 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3045 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3046 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3047 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3048 "Matches a link with spaces, optional angular brackets around it.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3049
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3050 (defconst org-link-re-with-space2
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3051 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3052 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3053 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3054 "[^]\t\n\r]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3055 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3056 "Matches a link with spaces, optional angular brackets around it.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3057
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3058 (defconst org-angle-link-re
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3059 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3060 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3061 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3062 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3063 "\\)>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3064 "Matches link with angular brackets, spaces are allowed.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3065 (defconst org-plain-link-re
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3066 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3067 "\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3068 "\\([^]\t\n\r<>,;() ]+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3069 "Matches plain link, without spaces.")
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3070
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3071 (defconst org-bracket-link-regexp
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3072 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3073 "Matches a link in double brackets.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3074
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3075 (defconst org-bracket-link-analytic-regexp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3076 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3077 "\\[\\["
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3078 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3079 "\\([^]]+\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3080 "\\]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3081 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3082 "\\]"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3083 ; 1: http:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3084 ; 2: http
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3085 ; 3: path
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3086 ; 4: [desc]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3087 ; 5: desc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3088
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3089
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3090 (defconst org-ts-lengths
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3091 (cons (length (format-time-string (car org-time-stamp-formats)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3092 (length (format-time-string (cdr org-time-stamp-formats))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3093 "This holds the lengths of the two different time formats.")
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3094 (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3095 "Regular expression for fast time stamp matching.")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3096 (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)[]>]"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3097 "Regular expression for fast time stamp matching.")
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
3098 (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3099 "Regular expression matching time strings for analysis.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3100 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3101 "Regular expression matching time stamps, with groups.")
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
3102 (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[]>]")
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
3103 "Regular expression matching time stamps (also [..]), with groups.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3104 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3105 "Regular expression matching a time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3106 (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3107 org-ts-regexp "\\)?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3108 "Regular expression matching a time stamp or time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3109
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3110 (defvar org-§emph-face nil)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3111
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3112 (defun org-do-emphasis-faces (limit)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3113 "Run through the buffer and add overlays to links."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3114 (if (re-search-forward org-emph-re limit t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3115 (progn
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3116 (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3117 'face
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3118 (nth 1 (assoc (match-string 3)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3119 org-emphasis-alist)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3120 (add-text-properties (match-beginning 2) (match-end 2)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3121 '(font-lock-multiline t))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3122 (backward-char 1)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3123 t)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3124
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3125 (defun org-activate-plain-links (limit)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3126 "Run through the buffer and add overlays to links."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3127 (if (re-search-forward org-plain-link-re limit t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3128 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3129 (add-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3130 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3131 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3132 ))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3133 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3134
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3135 (defun org-activate-angle-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3136 "Run through the buffer and add overlays to links."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3137 (if (re-search-forward org-angle-link-re limit t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3138 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3139 (add-text-properties (match-beginning 0) (match-end 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3140 (list 'mouse-face 'highlight
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3141 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3142 ))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3143 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3144
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3145 (defun org-activate-bracket-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3146 "Run through the buffer and add overlays to bracketed links."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3147 (if (re-search-forward org-bracket-link-regexp limit t)
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3148 (let* ((help (concat "LINK: "
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3149 (org-match-string-no-properties 1)))
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3150 ;; FIXME: above we should remove the escapes.
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3151 ;; but that requires another match, protecting match data,
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3152 ;; a lot of overhead for font-lock.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3153 (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3154 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3155 'help-echo help))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3156 (vp (list 'rear-nonsticky t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3157 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3158 'help-echo help)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3159 ;; We need to remove the invisible property here. Table narrowing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3160 ;; may have made some of this invisible.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3161 (remove-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3162 '(invisible nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3163 (if (match-end 3)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3164 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3165 (add-text-properties (match-beginning 0) (match-beginning 3) ip)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3166 (add-text-properties (match-beginning 3) (match-end 3) vp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3167 (add-text-properties (match-end 3) (match-end 0) ip))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3168 (add-text-properties (match-beginning 0) (match-beginning 1) ip)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3169 (add-text-properties (match-beginning 1) (match-end 1) vp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3170 (add-text-properties (match-end 1) (match-end 0) ip))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3171 t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3172
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3173 (defun org-activate-dates (limit)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3174 "Run through the buffer and add overlays to dates."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3175 (if (re-search-forward org-tsr-regexp limit t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3176 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3177 (add-text-properties (match-beginning 0) (match-end 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3178 (list 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3179 'keymap org-mouse-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3180 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3181
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3182 (defvar org-target-link-regexp nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3183 "Regular expression matching radio targets in plain text.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3184 (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3185 "Regular expression matching a link target.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3186 (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3187 "Regular expression matching a link target.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3188
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3189 (defun org-activate-target-links (limit)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3190 "Run through the buffer and add overlays to target matches."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3191 (when org-target-link-regexp
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3192 (let ((case-fold-search t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3193 (if (re-search-forward org-target-link-regexp limit t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3194 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3195 (add-text-properties (match-beginning 0) (match-end 0)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3196 (list 'mouse-face 'highlight
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3197 'keymap org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3198 'help-echo "Radio target link"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3199 'org-linked-text t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3200 t)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3201
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3202 (defun org-update-radio-target-regexp ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3203 "Find all radio targets in this file and update the regular expression."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3204 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3205 (when (memq 'radio org-activate-links)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3206 (setq org-target-link-regexp
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3207 (org-make-target-link-regexp (org-all-targets 'radio)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3208 (org-restart-font-lock)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3209
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3210 (defun org-hide-wide-columns (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3211 (let (s e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3212 (setq s (text-property-any (point) (or limit (point-max))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3213 'org-cwidth t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3214 (when s
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3215 (setq e (next-single-property-change s 'org-cwidth))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3216 (add-text-properties s e '(invisible org-cwidth intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3217 (goto-char e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3218 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3219
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3220 (defun org-restart-font-lock ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3221 "Restart font-lock-mode, to force refontification."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3222 (when (and (boundp 'font-lock-mode) font-lock-mode)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3223 (font-lock-mode -1)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3224 (font-lock-mode 1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3225
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3226 (defun org-all-targets (&optional radio)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3227 "Return a list of all targets in this file.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3228 With optional argument RADIO, only find radio targets."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3229 (let ((re (if radio org-radio-target-regexp org-target-regexp))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3230 rtn)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3231 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3232 (goto-char (point-min))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3233 (while (re-search-forward re nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3234 (add-to-list 'rtn (downcase (org-match-string-no-properties 1))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3235 rtn)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3236
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3237 (defun org-make-target-link-regexp (targets)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3238 "Make regular expression matching all strings in TARGETS.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3239 The regular expression finds the targets also if there is a line break
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3240 between words."
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3241 (and targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3242 (concat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3243 "\\<\\("
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3244 (mapconcat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3245 (lambda (x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3246 (while (string-match " +" x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3247 (setq x (replace-match "\\s-+" t t x)))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3248 x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3249 targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3250 "\\|")
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3251 "\\)\\>")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3252
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3253 (defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3254 "Matches CamelCase words, possibly with a star before it.")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3255
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3256 (defun org-activate-camels (limit)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3257 "Run through the buffer and add overlays to dates."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3258 (if (re-search-forward org-camel-regexp limit t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3259 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3260 (add-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3261 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3262 'keymap org-mouse-map))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3263 t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3264
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3265 (defun org-activate-tags (limit)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3266 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3267 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3268 (add-text-properties (match-beginning 1) (match-end 1)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3269 (list 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3270 'keymap org-mouse-map))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3271 t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3272
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3273 (defun org-font-lock-level ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3274 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3275 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3276 (- (match-end 0) (match-beginning 0))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
3277
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3278 (defun org-outline-level ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3279 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3280 (looking-at outline-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3281 (if (match-beginning 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3282 (+ (org-get-string-indentation (match-string 1)) 1000)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3283 (- (match-end 0) (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3284
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3285 (defvar org-font-lock-keywords nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3286
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3287 (defun org-set-font-lock-defaults ()
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3288 (let* ((em org-fontify-emphasized-text)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3289 (lk org-activate-links)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3290 (org-font-lock-extra-keywords
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3291 ;; Headlines
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3292 (list
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3293 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3294 (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3295 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3296 (1 'org-table))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3297 ;; Links
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3298 (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3299 (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3300 (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3301 (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3302 (if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3303 (if (memq 'camel lk) '(org-activate-camels (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3304 (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3305 (if org-table-limit-column-width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3306 '(org-hide-wide-columns (0 nil append)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3307 ;; TODO lines
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3308 (list (concat "^\\*+[ \t]*" org-not-done-regexp)
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3309 '(1 'org-todo t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3310 ;; Priorities
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3311 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3312 ;; Special keywords
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3313 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3314 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3315 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3316 (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3317 ;; Emphasis
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3318 (if em '(org-do-emphasis-faces))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3319 ;; Checkboxes, similar to Frank Ruell's org-checklet.el
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3320 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3321 2 'bold prepend)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3322 ;; COMMENT
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3323 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3324 "\\|" org-quote-string "\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3325 '(1 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3326 '("^#.*" (0 'font-lock-comment-face t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3327 ;; DONE
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3328 (if org-fontify-done-headline
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3329 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3330 '(1 'org-done t) '(2 'org-headline-done t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3331 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3332 '(1 'org-done t)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3333 ;; Table stuff
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3334 '("^[ \t]*\\(:.*\\)" (1 'org-table t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3335 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3336 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3337 (if org-format-transports-properties-p
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
3338 '("| *\\(<[0-9]+>\\) *" (1 'org-formula t)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3339 '("^\\*+ \\(.*:ARCHIVE:.*\\)" (1 'org-archived prepend))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3340 )))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
3341 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3342 ;; Now set the full font-lock-keywords
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3343 (set (make-local-variable 'org-font-lock-keywords)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3344 org-font-lock-extra-keywords)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3345 (set (make-local-variable 'font-lock-defaults)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3346 '(org-font-lock-keywords t nil nil backward-paragraph))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3347 (kill-local-variable 'font-lock-keywords) nil))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
3348
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3349 (defvar org-m nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3350 (defvar org-l nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3351 (defvar org-f nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3352 (defun org-get-level-face (n)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3353 "Get the right face for match N in font-lock matching of healdines."
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3354 (setq org-l (- (match-end 2) (match-beginning 1)))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3355 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3356 ; (setq org-f (nth (1- (% org-l org-n-levels)) org-level-faces))
69685
15d9920a3a63 (org-get-level-face): Fixed bug with level counting.
Carsten Dominik <dominik@science.uva.nl>
parents: 69620
diff changeset
3357 (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3358 (cond
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3359 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3360 ((eq n 2) org-f)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3361 (t (if org-level-color-stars-only nil org-f))))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3362
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3363 (defun org-unfontify-region (beg end &optional maybe_loudly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3364 "Remove fontification and activation overlays from links."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3365 (font-lock-default-unfontify-region beg end)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3366 (let* ((buffer-undo-list t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3367 (inhibit-read-only t) (inhibit-point-motion-hooks t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3368 (inhibit-modification-hooks t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3369 deactivate-mark buffer-file-name buffer-file-truename)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3370 (remove-text-properties beg end
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3371 '(mouse-face nil keymap nil org-linked-text nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3372 invisible nil intangible nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3373 ;;; Visibility cycling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3374
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3375 (defvar org-cycle-global-status nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3376 (make-variable-buffer-local 'org-cycle-global-status)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3377 (defvar org-cycle-subtree-status nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3378 (make-variable-buffer-local 'org-cycle-subtree-status)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3379
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3380 ;;;###autoload
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3381 (defun org-cycle (&optional arg)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
3382 "Visibility cycling for Org-mode.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3383
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3384 - When this function is called with a prefix argument, rotate the entire
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3385 buffer through 3 states (global cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3386 1. OVERVIEW: Show only top-level headlines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3387 2. CONTENTS: Show all headlines of all levels, but no body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3388 3. SHOW ALL: Show everything.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3389
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3390 - When point is at the beginning of a headline, rotate the subtree started
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3391 by this line through 3 different states (local cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3392 1. FOLDED: Only the main headline is shown.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3393 2. CHILDREN: The main headline and the direct children are shown.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3394 From this state, you can move to one of the children
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3395 and zoom in further.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3396 3. SUBTREE: Show the entire subtree, including body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3397
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
3398 - When there is a numeric prefix, go up to a heading with level ARG, do
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
3399 a `show-subtree' and return to the previous cursor position. If ARG
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
3400 is negative, go up that many levels.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
3401
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3402 - When point is not at the beginning of a headline, execute
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3403 `indent-relative', like TAB normally does. See the option
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3404 `org-cycle-emulate-tab' for details.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3405
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3406 - Special case: if point is the the beginning of the buffer and there is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3407 no headline in line 1, this function will act as if called with prefix arg."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3408 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3409
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3410 (let* ((outline-regexp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3411 (if org-cycle-include-plain-lists
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3412 "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3413 outline-regexp))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3414 (bob-special (and org-cycle-global-at-bob (bobp)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3415 (not (looking-at outline-regexp))))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3416 (org-cycle-hook
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3417 (if bob-special
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3418 (delq 'org-optimize-window-after-visibility-change
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3419 (copy-sequence org-cycle-hook))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3420 org-cycle-hook))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3421 (pos (point)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3422
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3423 (if (or bob-special (equal arg '(4)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3424 ;; special case: use global cycling
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3425 (setq arg t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3426
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3427 (cond
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3428
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3429 ((org-at-table-p 'any)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3430 ;; Enter the table or move to the next field in the table
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3431 (or (org-table-recognize-table.el)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3432 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3433 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3434 (org-table-justify-field-maybe)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3435 (call-interactively 'org-table-next-field)))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3436
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3437 ((eq arg t) ;; Global cycling
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3438
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3439 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3440 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3441 (eq org-cycle-global-status 'overview))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3442 ;; We just created the overview - now do table of contents
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3443 ;; This can be slow in very large buffers, so indicate action
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3444 (message "CONTENTS...")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3445 (org-content)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3446 (message "CONTENTS...done")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3447 (setq org-cycle-global-status 'contents)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3448 (run-hook-with-args 'org-cycle-hook 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3449
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3450 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3451 (eq org-cycle-global-status 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3452 ;; We just showed the table of contents - now show everything
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3453 (show-all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3454 (message "SHOW ALL")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3455 (setq org-cycle-global-status 'all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3456 (run-hook-with-args 'org-cycle-hook 'all))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3457
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3458 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3459 ;; Default action: go to overview
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3460 (org-overview)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3461 (message "OVERVIEW")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3462 (setq org-cycle-global-status 'overview)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3463 (run-hook-with-args 'org-cycle-hook 'overview))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3464
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3465 ((integerp arg)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3466 ;; Show-subtree, ARG levels up from here.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3467 (save-excursion
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3468 (org-back-to-heading)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3469 (outline-up-heading (if (< arg 0) (- arg)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3470 (- (funcall outline-level) arg)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3471 (org-show-subtree)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3472
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3473 ((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3474 ;; At a heading: rotate between three different views
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3475 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3476 (let ((goal-column 0) eoh eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3477 ;; First, some boundaries
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3478 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3479 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3480 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3481 (beginning-of-line 2)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3482 (while (and (not (eobp)) ;; this is like `next-line'
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3483 (get-char-property (1- (point)) 'invisible))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3484 (beginning-of-line 2)) (setq eol (point)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3485 (outline-end-of-heading) (setq eoh (point))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
3486 (org-end-of-subtree t) (setq eos (point))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3487 (outline-next-heading))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3488 ;; Find out what to do next and set `this-command'
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3489 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3490 ((and (= eos eoh)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3491 ;; Nothing is hidden behind this heading
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3492 (message "EMPTY ENTRY")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3493 (setq org-cycle-subtree-status nil)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3494 ((>= eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3495 ;; Entire subtree is hidden in one line: open it
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3496 (org-show-entry)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3497 (show-children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3498 (message "CHILDREN")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3499 (setq org-cycle-subtree-status 'children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3500 (run-hook-with-args 'org-cycle-hook 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3501 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3502 (eq org-cycle-subtree-status 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3503 ;; We just showed the children, now show everything.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3504 (org-show-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3505 (message "SUBTREE")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3506 (setq org-cycle-subtree-status 'subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3507 (run-hook-with-args 'org-cycle-hook 'subtree))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3508 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3509 ;; Default action: hide the subtree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3510 (hide-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3511 (message "FOLDED")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3512 (setq org-cycle-subtree-status 'folded)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3513 (run-hook-with-args 'org-cycle-hook 'folded)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3514
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3515 ;; TAB emulation
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3516 (buffer-read-only (org-back-to-heading))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3517
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3518 ((org-try-cdlatex-tab))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
3519
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3520 ((if (and (memq org-cycle-emulate-tab '(white whitestart))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3521 (save-excursion (beginning-of-line 1) (looking-at "[ \t]*"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3522 (or (and (eq org-cycle-emulate-tab 'white)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3523 (= (match-end 0) (point-at-eol)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3524 (and (eq org-cycle-emulate-tab 'whitestart)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
3525 (>= (match-end 0) pos))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3526 t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3527 (eq org-cycle-emulate-tab t))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3528 (if (and (looking-at "[ \n\r\t]")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3529 (string-match "^[ \t]*$" (buffer-substring
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3530 (point-at-bol) (point))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3531 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3532 (beginning-of-line 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3533 (and (looking-at "[ \t]+") (replace-match ""))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3534 (indent-relative))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3535
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3536 (t (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3537 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3538 (org-cycle))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3539
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3540 ;;;###autoload
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3541 (defun org-global-cycle (&optional arg)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3542 "Cycle the global visibility. For details see `org-cycle'."
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3543 (interactive "P")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3544 (if (integerp arg)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3545 (progn
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3546 (show-all)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3547 (hide-sublevels arg)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3548 (setq org-cycle-global-status 'contents))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3549 (org-cycle '(4))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3550
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3551 (defun org-overview ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3552 "Switch to overview mode, shoing only top-level headlines.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3553 Really, this shows all headlines with level equal or greater than the level
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3554 of the first headline in the buffer. This is important, because if the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3555 first headline is not level one, then (hide-sublevels 1) gives confusing
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3556 results."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3557 (interactive)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3558 (hide-sublevels (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3559 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3560 (if (re-search-forward (concat "^" outline-regexp) nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3561 (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3562 (goto-char (match-beginning 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3563 (funcall outline-level))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3564 1))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3565
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3566 ;; FIXME: allow an argument to give a limiting level for this.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3567 (defun org-content ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3568 "Show all headlines in the buffer, like a table of contents"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3569 (interactive)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3570 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3571 ;; Visit all headings and show their offspring
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3572 (goto-char (point-max))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3573 (catch 'exit
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3574 (while (and (progn (condition-case nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3575 (outline-previous-visible-heading 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3576 (error (goto-char (point-min))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3577 t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3578 (looking-at outline-regexp))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3579 (show-branches)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3580 (if (bobp) (throw 'exit nil))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3581
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3582
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3583 (defun org-optimize-window-after-visibility-change (state)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3584 "Adjust the window after a change in outline visibility.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3585 This function is the default value of the hook `org-cycle-hook'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3586 (when (get-buffer-window (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3587 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3588 ((eq state 'overview) (org-first-headline-recenter 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3589 ((eq state 'content) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3590 ((eq state 'all) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3591 ((eq state 'folded) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3592 ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3593 ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1))))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3594
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3595 (defun org-subtree-end-visible-p ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3596 "Is the end of the current subtree visible?"
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3597 (pos-visible-in-window-p
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
3598 (save-excursion (org-end-of-subtree t) (point))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3599
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3600 (defun org-first-headline-recenter (&optional N)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3601 "Move cursor to the first headline and recenter the headline.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3602 Optional argument N means, put the headline into the Nth line of the window."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3603 (goto-char (point-min))
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
3604 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3605 (beginning-of-line)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3606 (recenter (prefix-numeric-value N))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3607
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3608 (defvar org-goto-window-configuration nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3609 (defvar org-goto-marker nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3610 (defvar org-goto-map (make-sparse-keymap))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3611 (let ((cmds '(isearch-forward isearch-backward)) cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3612 (while (setq cmd (pop cmds))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3613 (substitute-key-definition cmd cmd org-goto-map global-map)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3614 (define-key org-goto-map "\C-m" 'org-goto-ret)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3615 (define-key org-goto-map [(left)] 'org-goto-left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3616 (define-key org-goto-map [(right)] 'org-goto-right)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3617 (define-key org-goto-map [(?q)] 'org-goto-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3618 (define-key org-goto-map [(control ?g)] 'org-goto-quit)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3619 (define-key org-goto-map "\C-i" 'org-cycle)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
3620 (define-key org-goto-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3621 (define-key org-goto-map [(down)] 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3622 (define-key org-goto-map [(up)] 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3623 (define-key org-goto-map "n" 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3624 (define-key org-goto-map "p" 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3625 (define-key org-goto-map "f" 'outline-forward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3626 (define-key org-goto-map "b" 'outline-backward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3627 (define-key org-goto-map "u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3628 (define-key org-goto-map "\C-c\C-n" 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3629 (define-key org-goto-map "\C-c\C-p" 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3630 (define-key org-goto-map "\C-c\C-f" 'outline-forward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3631 (define-key org-goto-map "\C-c\C-b" 'outline-backward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3632 (define-key org-goto-map "\C-c\C-u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3633 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3634 (while l (define-key org-goto-map (int-to-string (pop l)) 'digit-argument)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3635
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3636 (defconst org-goto-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3637 "Select a location to jump to, press RET
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3638 \[Up]/[Down]=next/prev headline TAB=cycle visibility RET=select [Q]uit")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3639
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3640 (defun org-goto ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3641 "Go to a different location of the document, keeping current visibility.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3642
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3643 When you want to go to a different location in a document, the fastest way
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3644 is often to fold the entire buffer and then dive into the tree. This
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3645 method has the disadvantage, that the previous location will be folded,
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3646 which may not be what you want.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3647
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3648 This command works around this by showing a copy of the current buffer in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3649 overview mode. You can dive into the tree in that copy, to find the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3650 location you want to reach. When pressing RET, the command returns to the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3651 original buffer in which the visibility is still unchanged. It then jumps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3652 to the new location, making it and the headline hierarchy above it visible."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3653 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3654 (let* ((org-goto-start-pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3655 (selected-point
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3656 (org-get-location (current-buffer) org-goto-help)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3657 (if selected-point
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3658 (progn
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3659 (org-mark-ring-push org-goto-start-pos)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3660 (goto-char selected-point)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3661 (if (or (org-invisible-p) (org-invisible-p2))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3662 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3663 (error "Quit"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3664
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3665 (defun org-get-location (buf help)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3666 "Let the user select a location in the Org-mode buffer BUF.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3667 This function uses a recursive edit. It returns the selected position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3668 or nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3669 (let (org-selected-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3670 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3671 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3672 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3673 (switch-to-buffer (get-buffer-create "*org-goto*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3674 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3675 (princ help))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3676 (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3677 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3678 (erase-buffer)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
3679 (insert-buffer-substring buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3680 (let ((org-startup-truncated t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3681 (org-startup-folded t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3682 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3683 (org-startup-with-deadline-check nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3684 (org-mode))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3685 (setq buffer-read-only t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3686 (if (boundp 'org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3687 (goto-char org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3688 (goto-char (point-min)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3689 (org-beginning-of-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3690 (message "Select location and press RET")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3691 ;; now we make sure that during selection, ony very few keys work
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3692 ;; and that it is impossible to switch to another window.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3693 (let ((gm (current-global-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3694 (overriding-local-map org-goto-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3695 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3696 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3697 (use-global-map org-goto-map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3698 (recursive-edit))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3699 (use-global-map gm)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3700 (kill-buffer "*org-goto*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3701 org-selected-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3702
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3703 (defun org-goto-ret (&optional arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3704 "Finish `org-goto' by going to the new location."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3705 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3706 (setq org-selected-point (point)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3707 current-prefix-arg arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3708 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3709
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3710 (defun org-goto-left ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3711 "Finish `org-goto' by going to the new location."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3712 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3713 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3714 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3715 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3716 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3717 current-prefix-arg (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3718 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3719 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3720
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3721 (defun org-goto-right ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3722 "Finish `org-goto' by going to the new location."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3723 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3724 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3725 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3726 (outline-end-of-subtree)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3727 (or (eobp) (forward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3728 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3729 current-prefix-arg (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3730 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3731 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3732
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3733 (defun org-goto-quit ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3734 "Finish `org-goto' without cursor motion."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3735 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3736 (setq org-selected-point nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3737 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3738
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3739 ;;; Promotion, Demotion, Inserting new headlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3740
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3741 (defvar org-ignore-region nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3742 "To temporarily disable the active region.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3743
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3744 (defun org-insert-heading (&optional force-heading)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3745 "Insert a new heading or item with same depth at point.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3746 If point is in a plain list and FORCE-HEADING is nil, create a new list item.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3747 If point is at the beginning of a headline, insert a sibling before the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3748 current headline. If point is in the middle of a headline, split the headline
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3749 at that position and make the rest of the headline part of the sibling below
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3750 the current headline."
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3751 (interactive "P")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3752 (if (= (buffer-size) 0)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3753 (insert "\n* ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3754 (when (or force-heading (not (org-insert-item)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3755 (let* ((head (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3756 (condition-case nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3757 (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3758 (org-back-to-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3759 (match-string 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3760 (error "*"))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3761 pos)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3762 (cond
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3763 ((and (org-on-heading-p) (bolp)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3764 (save-excursion (backward-char 1) (not (org-invisible-p))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3765 (open-line 1))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3766 ((and (bolp) (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3767 (backward-char 1) (not (org-invisible-p))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
3768 nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3769 (t (newline)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3770 (insert head) (just-one-space)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3771 (setq pos (point))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3772 (end-of-line 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3773 (unless (= (point) pos) (just-one-space) (backward-delete-char 1))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3774 (run-hooks 'org-insert-heading-hook)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3775
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3776 (defun org-insert-item (&optional checkbox)
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3777 "Insert a new item at the current level.
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
3778 Return t when things worked, nil when we are not in an item."
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3779 (when (save-excursion
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3780 (condition-case nil
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3781 (progn
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3782 (org-beginning-of-item)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3783 (org-at-item-p)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3784 t)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3785 (error nil)))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3786 (let* ((bul (match-string 0))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3787 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3788 (match-end 0)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3789 pos)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3790 (cond
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3791 ((and (org-at-item-p) (<= (point) eow))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3792 ;; before the bullet
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3793 (beginning-of-line 1)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3794 (open-line 1))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3795 ((<= (point) eow)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3796 (beginning-of-line 1))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3797 (t (newline)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3798 (insert bul (if checkbox "[ ]" ""))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3799 (just-one-space)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3800 (setq pos (point))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3801 (end-of-line 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3802 (unless (= (point) pos) (just-one-space) (backward-delete-char 1)))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3803 (org-maybe-renumber-ordered-list)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3804 t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3805
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3806 (defun org-insert-todo-heading (arg)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3807 "Insert a new heading with the same level and TODO state as current heading.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3808 If the heading has no TODO state, or if the state is DONE, use the first
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3809 state (TODO by default). Also with prefix arg, force first state."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3810 (interactive "P")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3811 (when (not (org-insert-item 'checkbox))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3812 (org-insert-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3813 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3814 (org-back-to-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3815 (if org-noutline-p
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3816 (outline-previous-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3817 (outline-previous-visible-heading t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3818 (looking-at org-todo-line-regexp))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3819 (if (or arg
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3820 (not (match-beginning 2))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3821 (equal (match-string 2) org-done-string))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3822 (insert (car org-todo-keywords) " ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
3823 (insert (match-string 2) " "))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3824
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3825 (defun org-promote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3826 "Promote the entire subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3827 See also `org-promote'."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3828 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3829 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3830 (org-map-tree 'org-promote)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3831
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3832 (defun org-demote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3833 "Demote the entire subtree. See `org-demote'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3834 See also `org-promote'."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3835 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3836 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3837 (org-map-tree 'org-demote)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3838
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3839 (defun org-do-promote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3840 "Promote the current heading higher up the tree.
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
3841 If the region is active in `transient-mark-mode', promote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3842 in the region."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3843 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3844 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3845 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3846 (org-map-region 'org-promote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3847 (org-promote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3848 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3849
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3850 (defun org-do-demote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3851 "Demote the current heading lower down the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3852 If the region is active in `transient-mark-mode', demote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3853 in the region."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3854 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3855 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3856 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3857 (org-map-region 'org-demote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3858 (org-demote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3859 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3860
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3861 (defun org-fix-position-after-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3862 "Make sure that after pro/demotion cursor position is right."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3863 (and (equal (char-after) ?\ )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3864 (equal (char-before) ?*)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3865 (forward-char 1)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3866
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3867 (defun org-get-legal-level (level change)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3868 "Rectify a level change under the influence of `org-odd-levels-only'
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3869 LEVEL is a current level, CHANGE is by how much the level should be
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3870 modified. Even if CHANGE is nil, LEVEL may be returned modified because
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3871 even level numbers will become the next higher odd number."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3872 (if org-odd-levels-only
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3873 (cond ((not change) (1+ (* 2 (/ level 2))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3874 ((> change 0) (1+ (* 2 (/ (+ level (* 2 change)) 2))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3875 ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2))))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3876 (max 1 (+ level change))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3877
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3878 (defun org-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3879 "Promote the current heading higher up the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3880 If the region is active in `transient-mark-mode', promote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3881 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3882 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3883 (let* ((level (save-match-data (funcall outline-level)))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3884 (up-head (make-string (org-get-legal-level level -1) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3885 (diff (abs (- level (length up-head)))))
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
3886 (if (= level 1) (error "Cannot promote to level 0. UNDO to recover"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3887 (replace-match up-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3888 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3889 (and org-auto-align-tags (org-set-tags nil t))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3890 (if org-adapt-indentation (org-fixup-indentation (- diff)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3891
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3892 (defun org-demote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3893 "Demote the current heading lower down the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3894 If the region is active in `transient-mark-mode', demote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3895 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3896 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3897 (let* ((level (save-match-data (funcall outline-level)))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3898 (down-head (make-string (org-get-legal-level level 1) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3899 (diff (abs (- level (length down-head)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3900 (replace-match down-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3901 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3902 (and org-auto-align-tags (org-set-tags nil t))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3903 (if org-adapt-indentation (org-fixup-indentation diff))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3904
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3905 (defun org-map-tree (fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3906 "Call FUN for every heading underneath the current one."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3907 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3908 (let ((level (funcall outline-level)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3909 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3910 (funcall fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3911 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3912 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3913 (> (funcall outline-level) level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3914 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3915 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3916
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3917 (defun org-map-region (fun beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3918 "Call FUN for every heading between BEG and END."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3919 (let ((org-ignore-region t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3920 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3921 (setq end (copy-marker end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3922 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3923 (if (and (re-search-forward (concat "^" outline-regexp) nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3924 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3925 (funcall fun))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3926 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3927 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3928 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3929 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3930 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3931
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3932 (defun org-fixup-indentation (diff)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3933 "Change the indentation in the current entry by DIFF
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3934 However, if any line in the current entry has no indentation, or if it
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3935 would end up with no indentation after the change, nothing at all is done."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3936 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3937 (let ((end (save-excursion (outline-next-heading)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3938 (point-marker)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3939 (prohibit (if (> diff 0)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3940 "^\\S-"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3941 (concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-")))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3942 col)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3943 (unless (save-excursion (re-search-forward prohibit end t))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3944 (while (re-search-forward "^[ \t]+" end t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3945 (goto-char (match-end 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3946 (setq col (current-column))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3947 (if (< diff 0) (replace-match ""))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
3948 (indent-to (+ diff col))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3949 (move-marker end nil))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3950
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3951 ;;; Vertical tree motion, cutting and pasting of subtrees
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3952
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3953 (defun org-move-subtree-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3954 "Move the current subtree up past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3955 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3956 (org-move-subtree-down (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3957
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3958 (defun org-move-subtree-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3959 "Move the current subtree down past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3960 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3961 (setq arg (prefix-numeric-value arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3962 (let ((movfunc (if (> arg 0) 'outline-get-next-sibling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3963 'outline-get-last-sibling))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3964 (ins-point (make-marker))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3965 (cnt (abs arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3966 beg end txt folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3967 ;; Select the tree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3968 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3969 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3970 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3971 (save-excursion (outline-end-of-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3972 (setq folded (org-invisible-p)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3973 (outline-end-of-subtree))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
3974 (outline-next-heading)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3975 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3976 ;; Find insertion point, with error handling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3977 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3978 (while (> cnt 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3979 (or (and (funcall movfunc) (looking-at outline-regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3980 (progn (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3981 (error "Cannot move past superior level or buffer limit")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3982 (setq cnt (1- cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3983 (if (> arg 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3984 ;; Moving forward - still need to move over subtree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3985 (progn (outline-end-of-subtree)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3986 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3987 (if (not (or (looking-at (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3988 (bolp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3989 (newline))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3990 (move-marker ins-point (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3991 (setq txt (buffer-substring beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3992 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3993 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3994 (goto-char ins-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3995 (if folded (hide-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3996 (move-marker ins-point nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3997
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3998 (defvar org-subtree-clip ""
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3999 "Clipboard for cut and paste of subtrees.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4000 This is actually only a copy of the kill, because we use the normal kill
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4001 ring. We need it to check if the kill was created by `org-copy-subtree'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4002
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4003 (defvar org-subtree-clip-folded nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4004 "Was the last copied subtree folded?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4005 This is used to fold the tree back after pasting.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4006
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4007 (defun org-cut-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4008 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4009 This is a short-hand for marking the subtree and then cutting it."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4010 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4011 (org-copy-subtree 'cut))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4012
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4013 (defun org-copy-subtree (&optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4014 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4015 This is a short-hand for marking the subtree and then copying it.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4016 If CUT is non nil, actually cut the subtree."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4017 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4018 (let (beg end folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4019 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4020 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4021 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4022 (save-excursion (outline-end-of-heading)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4023 (setq folded (org-invisible-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4024 (outline-end-of-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4025 (if (equal (char-after) ?\n) (forward-char 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4026 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4027 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4028 (when (> end beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4029 (setq org-subtree-clip-folded folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4030 (if cut (kill-region beg end) (copy-region-as-kill beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4031 (setq org-subtree-clip (current-kill 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4032 (message "%s: Subtree with %d characters"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4033 (if cut "Cut" "Copied")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4034 (length org-subtree-clip)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4035
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4036 (defun org-paste-subtree (&optional level tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4037 "Paste the clipboard as a subtree, with modification of headline level.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4038 The entire subtree is promoted or demoted in order to match a new headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4039 level. By default, the new level is derived from the visible headings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4040 before and after the insertion point, and taken to be the inferior headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4041 level of the two. So if the previous visible heading is level 3 and the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4042 next is level 4 (or vice versa), level 4 will be used for insertion.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4043 This makes sure that the subtree remains an independent subtree and does
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4044 not swallow low level entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4045
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4046 You can also force a different level, either by using a numeric prefix
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4047 argument, or by inserting the heading marker by hand. For example, if the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4048 cursor is after \"*****\", then the tree will be shifted to level 5.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4049
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4050 If you want to insert the tree as is, just use \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4051
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4052 If optional TREE is given, use this text instead of the kill ring."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4053 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4054 (unless (org-kill-is-subtree-p tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4055 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4056 (substitute-command-keys
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4057 "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4058 (let* ((txt (or tree (and kill-ring (current-kill 0))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4059 (^re (concat "^\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4060 (re (concat "\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4061 (^re_ (concat "\\(" outline-regexp "\\)[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4062
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4063 (old-level (if (string-match ^re txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4064 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4065 -1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4066 (force-level (cond (level (prefix-numeric-value level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4067 ((string-match
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4068 ^re_ (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4069 (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4070 (t nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4071 (previous-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4072 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4073 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4074 (outline-previous-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4075 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4076 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4077 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4078 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4079 (next-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4080 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4081 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4082 (outline-next-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4083 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4084 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4085 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4086 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4087 (new-level (or force-level (max previous-level next-level)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4088 (shift (if (or (= old-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4089 (= new-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4090 (= old-level new-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4091 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4092 (- new-level old-level)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4093 (shift1 shift)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4094 (delta (if (> shift 0) -1 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4095 (func (if (> shift 0) 'org-demote 'org-promote))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
4096 (org-odd-levels-only nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4097 beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4098 ;; Remove the forces level indicator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4099 (if force-level
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4100 (delete-region (point-at-bol) (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4101 ;; Make sure we start at the beginning of an empty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4102 (if (not (bolp)) (insert "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4103 (if (not (looking-at "[ \t]*$"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4104 (progn (insert "\n") (backward-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4105 ;; Paste
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4106 (setq beg (point))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4107 (if (string-match "[ \t\r\n]+\\'" txt)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4108 (setq txt (replace-match "\n" t t txt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4109 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4110 (setq end (point))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4111 (if (looking-at "[ \t\r\n]+")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4112 (replace-match "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4113 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4114 ;; Shift if necessary
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4115 (if (= shift 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4116 (message "Pasted at level %d, without shift" new-level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4117 (save-restriction
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4118 (narrow-to-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4119 (while (not (= shift 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4120 (org-map-region func (point-min) (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4121 (setq shift (+ delta shift)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4122 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4123 (message "Pasted at level %d, with shift by %d levels"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4124 new-level shift1)))
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4125 (if (and kill-ring
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4126 (eq org-subtree-clip (current-kill 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4127 org-subtree-clip-folded)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4128 ;; The tree was folded before it was killed/copied
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4129 (hide-subtree))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4130
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4131 (defun org-kill-is-subtree-p (&optional txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4132 "Check if the current kill is an outline subtree, or a set of trees.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4133 Returns nil if kill does not start with a headline, or if the first
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4134 headline level is not the largest headline level in the tree.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4135 So this will actually accept several entries of equal levels as well,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4136 which is OK for `org-paste-subtree'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4137 If optional TXT is given, check this string instead of the current kill."
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4138 (let* ((kill (or txt (and kill-ring (current-kill 0)) ""))
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4139 (start-level (and kill
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4140 (string-match (concat "\\`" outline-regexp) kill)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4141 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4142 (re (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4143 (start 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4144 (if (not start-level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4145 nil ;; does not even start with a heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4146 (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4147 (while (setq start (string-match re kill (1+ start)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4148 (if (< (- (match-end 0) (match-beginning 0)) start-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4149 (throw 'exit nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4150 t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4151
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4152 (defun org-narrow-to-subtree ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4153 "Narrow buffer to the current subtree."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4154 (interactive)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4155 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4156 (narrow-to-region
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4157 (progn (org-back-to-heading) (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4158 (progn (org-end-of-subtree t) (point)))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4159
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4160 ;;; Plain list items
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4161
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4162 (defun org-at-item-p ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4163 "Is point in a line starting a hand-formatted item?"
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4164 (let ((llt org-plain-list-ordered-item-terminator))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4165 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4166 (goto-char (point-at-bol))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4167 (looking-at
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4168 (cond
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4169 ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4170 ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4171 ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4172 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4173
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4174 (defun org-at-item-checkbox-p ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4175 "Is point at a line starting a plain-list item with a checklet?"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4176 (and (org-at-item-p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4177 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4178 (goto-char (match-end 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4179 (skip-chars-forward " \t")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4180 (looking-at "\\[[ X]\\]"))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4181
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4182 (defun org-toggle-checkbox (&optional arg)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4183 "Toggle the checkbox in the current line."
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4184 (interactive "P")
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4185 (catch 'exit
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4186 (let (beg end status (firstnew 'unknown))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4187 (cond
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4188 ((org-region-active-p)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4189 (setq beg (region-beginning) end (region-end)))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4190 ((org-on-heading-p)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4191 (setq beg (point) end (save-excursion (outline-next-heading) (point))))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4192 ((org-at-item-checkbox-p)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4193 (save-excursion
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4194 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4195 (throw 'exit t))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4196 (t (error "Not at a checkbox or heading, and no active region")))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4197 (save-excursion
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4198 (goto-char beg)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4199 (while (< (point) end)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4200 (when (org-at-item-checkbox-p)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4201 (setq status (equal (match-string 0) "[X]"))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4202 (when (eq firstnew 'unknown)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4203 (setq firstnew (not status)))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4204 (replace-match
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4205 (if (if arg (not status) firstnew) "[X]" "[ ]") t t))
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4206 (beginning-of-line 2))))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4207
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4208 (defun org-get-indentation (&optional line)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4209 "Get the indentation of the current line, interpreting tabs.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4210 When LINE is given, assume it represents a line and compute its indentation."
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4211 (if line
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4212 (if (string-match "^ *" (org-remove-tabs line))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4213 (match-end 0))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4214 (save-excursion
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4215 (beginning-of-line 1)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4216 (skip-chars-forward " \t")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4217 (current-column))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4218
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4219 (defun org-remove-tabs (s &optional width)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4220 "Replace tabulators in S with spaces.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4221 Assumes that s is a single line, starting in column 0."
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4222 (setq width (or width tab-width))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4223 (while (string-match "\t" s)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4224 (setq s (replace-match
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4225 (make-string
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4226 (- (* width (/ (+ (match-beginning 0) width) width))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4227 (match-beginning 0)) ?\ )
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4228 t t s)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4229 s)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4230
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4231 ;; FIXME: document properly.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4232 (defun org-fix-indentation (line ind)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4233 "If the current indenation is smaller than ind1, leave it alone.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4234 If it is larger than ind, reduce it by ind."
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4235 (let* ((l (org-remove-tabs line))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4236 (i (org-get-indentation l))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4237 (i1 (car ind)) (i2 (cdr ind)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4238 (if (>= i i2) (setq l (substring line i2)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4239 (if (> i1 0)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4240 (concat (make-string i1 ?\ ) l)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4241 l)))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4242
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4243 (defun org-beginning-of-item ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4244 "Go to the beginning of the current hand-formatted item.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4245 If the cursor is not in an item, throw an error."
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4246 (interactive)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4247 (let ((pos (point))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4248 (limit (save-excursion (org-back-to-heading)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4249 (beginning-of-line 2) (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4250 ind ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4251 (if (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4252 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4253 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4254 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4255 (setq ind (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4256 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4257 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4258 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4259 (if (< (point) limit) (throw 'exit nil))
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4260 (unless (looking-at "[ \t]*$")
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4261 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4262 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4263 (if (< ind1 ind)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4264 (throw 'exit (org-at-item-p))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4265 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4266 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4267 (error "Not in an item")))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4268
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4269 (defun org-end-of-item ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4270 "Go to the end of the current hand-formatted item.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4271 If the cursor is not in an item, throw an error."
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4272 (interactive)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4273 (let ((pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4274 (limit (save-excursion (outline-next-heading) (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4275 (ind (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4276 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4277 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4278 (current-column)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4279 ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4280 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4281 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4282 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4283 (if (>= (point) limit) (throw 'exit t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4284 (unless (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4285 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4286 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4287 (if (<= ind1 ind) (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4288 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4289 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4290 (error "Not in an item"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4291
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4292 (defun org-next-item ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4293 "Move to the beginning of the next item in the current plain list.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4294 Error if not at a plain list, or if this is the last item in the list."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4295 (interactive)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4296 (let (ind ind1 (pos (point)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4297 (org-beginning-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4298 (setq ind (org-get-indentation))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4299 (org-end-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4300 (setq ind1 (org-get-indentation))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4301 (unless (and (org-at-item-p) (= ind ind1))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4302 (goto-char pos)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
4303 (error "On last item"))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4304
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4305 (defun org-previous-item ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4306 "Move to the beginning of the previous item in the current plain list.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4307 Error if not at a plain list, or if this is the last item in the list."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4308 (interactive)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4309 (let (beg ind (pos (point)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4310 (org-beginning-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4311 (setq beg (point))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4312 (setq ind (org-get-indentation))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4313 (goto-char beg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4314 (catch 'exit
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4315 (while t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4316 (beginning-of-line 0)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4317 (if (looking-at "[ \t]*$")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4318 nil
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4319 (if (<= (org-get-indentation) ind)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4320 (throw 'exit t)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4321 (condition-case nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4322 (org-beginning-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4323 (error (goto-char pos)
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
4324 (error "On first item")))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4325
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4326 (defun org-move-item-down ()
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4327 "Move the plain list item at point down, i.e. swap with following item.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4328 Subitems (items with larger indentation) are considered part of the item,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4329 so this really moves item trees."
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4330 (interactive)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4331 (let (beg end ind ind1 (pos (point)) txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4332 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4333 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4334 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4335 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4336 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4337 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4338 (if (and (org-at-item-p) (= ind ind1))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4339 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4340 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4341 (setq txt (buffer-substring beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4342 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4343 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4344 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4345 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4346 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4347 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4348 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4349 (error "Cannot move this item further down"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4350
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4351 (defun org-move-item-up (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4352 "Move the plain list item at point up, i.e. swap with previous item.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4353 Subitems (items with larger indentation) are considered part of the item,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4354 so this really moves item trees."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4355 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4356 (let (beg end ind ind1 (pos (point)) txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4357 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4358 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4359 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4360 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4361 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4362 (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4363 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4364 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4365 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4366 (if (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4367 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4368 (if (<= (setq ind1 (org-get-indentation)) ind)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4369 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4370 (condition-case nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4371 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4372 (error (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4373 (error "Cannot move this item further up")))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4374 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4375 (if (and (org-at-item-p) (= ind ind1))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4376 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4377 (setq txt (buffer-substring beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4378 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4379 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4380 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4381 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4382 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4383 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4384 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4385 (error "Cannot move this item further up"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4386
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4387 (defun org-maybe-renumber-ordered-list ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4388 "Renumber the ordered list at point if setup allows it.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4389 This tests the user option `org-auto-renumber-ordered-lists' before
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4390 doing the renumbering."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4391 (and org-auto-renumber-ordered-lists
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4392 (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4393 (match-beginning 3)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4394 (org-renumber-ordered-list 1)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4395
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4396 (defun org-get-string-indentation (s)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4397 "What indentation has S due to SPACE and TAB at the beginning of the string?"
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4398 (let ((n -1) (i 0) (w tab-width) c)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4399 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4400 (while (< (setq n (1+ n)) (length s))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4401 (setq c (aref s n))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4402 (cond ((= c ?\ ) (setq i (1+ i)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4403 ((= c ?\t) (setq i (* (/ (+ w i) w) w)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4404 (t (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4405 i))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4406
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4407 (defun org-renumber-ordered-list (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4408 "Renumber an ordered plain list.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4409 Cursor needs to be in the first line of an item, the line that starts
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4410 with something like \"1.\" or \"2)\"."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4411 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4412 (unless (and (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4413 (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4414 (error "This is not an ordered list"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4415 (let ((line (org-current-line))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4416 (col (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4417 (ind (org-get-string-indentation
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4418 (buffer-substring (point-at-bol) (match-beginning 3))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4419 ;; (term (substring (match-string 3) -1))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4420 ind1 (n (1- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4421 ;; find where this list begins
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4422 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4423 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4424 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4425 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4426 (if (looking-at "[ \t]*$") (throw 'next t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4427 (skip-chars-forward " \t") (setq ind1 (current-column))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
4428 (if (or (< ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
4429 (and (= ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
4430 (not (org-at-item-p))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4431 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4432 ;; Walk forward and replace these numbers
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4433 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4434 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4435 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4436 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4437 (if (eobp) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4438 (if (looking-at "[ \t]*$") (throw 'next nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4439 (skip-chars-forward " \t") (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4440 (if (> ind1 ind) (throw 'next t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4441 (if (< ind1 ind) (throw 'exit t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4442 (if (not (org-at-item-p)) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4443 (if (not (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4444 (error "unordered bullet in ordered list. Press \\[undo] to recover"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4445 (delete-region (match-beginning 3) (1- (match-end 3)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4446 (goto-char (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4447 (insert (format "%d" (setq n (1+ n)))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4448 (goto-line line)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4449 (move-to-column col)))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
4450
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4451 (defvar org-last-indent-begin-marker (make-marker))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4452 (defvar org-last-indent-end-marker (make-marker))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4453
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4454 (defun org-outdent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4455 "Outdent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4456 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4457 (org-indent-item (- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4458
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4459 (defun org-indent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4460 "Indent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4461 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4462 (unless (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4463 (error "Not on an item"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4464 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4465 (let (beg end ind ind1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4466 (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4467 (setq beg org-last-indent-begin-marker
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4468 end org-last-indent-end-marker)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4469 (org-beginning-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4470 (setq beg (move-marker org-last-indent-begin-marker (point)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4471 (org-end-of-item)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4472 (setq end (move-marker org-last-indent-end-marker (point))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4473 (goto-char beg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4474 (skip-chars-forward " \t") (setq ind (current-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4475 (if (< (+ arg ind) 0) (error "Cannot outdent beyond margin"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4476 (while (< (point) end)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4477 (beginning-of-line 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4478 (skip-chars-forward " \t") (setq ind1 (current-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4479 (delete-region (point-at-bol) (point))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4480 (indent-to-column (+ ind1 arg))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4481 (beginning-of-line 2)))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4482
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4483 ;;; Archiving
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
4484
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4485 (defun org-archive-subtree (&optional find-done)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4486 "Move the current subtree to the archive.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4487 The archive can be a certain top-level heading in the current file, or in
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4488 a different file. The tree will be moved to that location, the subtree
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4489 heading be marked DONE, and the current time will be added.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4490
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4491 When called with prefix argument FIND-DONE, find whole trees without any
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4492 open TODO items and archive them (after getting confirmation from the user).
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4493 If the cursor is not at a headline when this comand is called, try all level
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4494 1 trees. If the cursor is on a headline, only try the direct children of
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4495 this heading. "
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4496 (interactive "P")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4497 (if find-done
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4498 (org-archive-all-done)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4499 ;; Save all relevant TODO keyword-relatex variables
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4500
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4501 (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4502 (tr-org-todo-keywords org-todo-keywords)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4503 (tr-org-todo-interpretation org-todo-interpretation)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4504 (tr-org-done-string org-done-string)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4505 (tr-org-todo-regexp org-todo-regexp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4506 (tr-org-todo-line-regexp org-todo-line-regexp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4507 (this-buffer (current-buffer))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4508 file heading buffer level newfile-p)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4509 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4510 (progn
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4511 (setq file (format (match-string 1 org-archive-location)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4512 (file-name-nondirectory buffer-file-name))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4513 heading (match-string 2 org-archive-location)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4514 (error "Invalid `org-archive-location'"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4515 (if (> (length file) 0)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4516 (setq newfile-p (not (file-exists-p file))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4517 buffer (find-file-noselect file))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4518 (setq buffer (current-buffer)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4519 (unless buffer
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4520 (error "Cannot access file \"%s\"" file))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4521 (if (and (> (length heading) 0)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4522 (string-match "^\\*+" heading))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4523 (setq level (match-end 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4524 (setq heading nil level 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4525 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4526 ;; We first only copy, in case something goes wrong
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4527 ;; we need to protect this-command, to avoid kill-region sets it,
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4528 ;; which would lead to duplication of subtrees
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4529 (let (this-command) (org-copy-subtree))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4530 (set-buffer buffer)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4531 ;; Enforce org-mode for the archive buffer
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
4532 (if (not (org-mode-p))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4533 ;; Force the mode for future visits.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4534 (let ((org-insert-mode-line-in-empty-file t))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4535 (call-interactively 'org-mode)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4536 (when newfile-p
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4537 (goto-char (point-max))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4538 (insert (format "\nArchived entries from file %s\n\n"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4539 (buffer-file-name this-buffer))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4540 ;; Force the TODO keywords of the original buffer
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4541 (let ((org-todo-line-regexp tr-org-todo-line-regexp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4542 (org-todo-keywords tr-org-todo-keywords)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4543 (org-todo-interpretation tr-org-todo-interpretation)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4544 (org-done-string tr-org-done-string)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4545 (org-todo-regexp tr-org-todo-regexp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4546 (org-todo-line-regexp tr-org-todo-line-regexp))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4547 (goto-char (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4548 (if heading
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4549 (progn
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4550 (if (re-search-forward
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4551 (concat "\\(^\\|\r\\)"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4552 (regexp-quote heading) "[ \t]*\\($\\|\r\\)")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4553 nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4554 (goto-char (match-end 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4555 ;; Heading not found, just insert it at the end
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4556 (goto-char (point-max))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4557 (or (bolp) (insert "\n"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4558 (insert "\n" heading "\n")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4559 (end-of-line 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4560 ;; Make the subtree visible
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4561 (show-subtree)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4562 (org-end-of-subtree t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4563 (skip-chars-backward " \t\r\n]")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4564 (and (looking-at "[ \t\r\n]*")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4565 (replace-match "\n\n")))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4566 ;; No specific heading, just go to end of file.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4567 (goto-char (point-max)) (insert "\n"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4568 ;; Paste
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4569 (org-paste-subtree (1+ level))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4570 ;; Mark the entry as done, i.e. set to last work in org-todo-keywords
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4571 (if org-archive-mark-done
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4572 (org-todo (length org-todo-keywords)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4573 ;; Move cursor to right after the TODO keyword
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4574 (when org-archive-stamp-time
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4575 (beginning-of-line 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4576 (looking-at org-todo-line-regexp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4577 (goto-char (or (match-end 2) (match-beginning 3)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4578 (insert "(" (format-time-string (cdr org-time-stamp-formats)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4579 (org-current-time))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4580 ")"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4581 ;; Save the buffer, if it is not the same buffer.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4582 (if (not (eq this-buffer buffer)) (save-buffer))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4583 ;; Here we are back in the original buffer. Everything seems to have
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4584 ;; worked. So now cut the tree and finish up.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4585 (let (this-command) (org-cut-subtree))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4586 (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4587 (message "Subtree archived %s"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4588 (if (eq this-buffer buffer)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4589 (concat "under heading: " heading)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4590 (concat "in file: " (abbreviate-file-name file)))))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4591
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4592 (defun org-archive-all-done (&optional tag)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4593 "Archive sublevels of the current tree without open TODO items.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4594 If the cursor is not on a headline, try all level 1 trees. If
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4595 it is on a headline, try all direct children.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4596 When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4597 (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4598 (rea (concat ".*:" org-archive-tag ":"))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4599 (begm (make-marker))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4600 (endm (make-marker))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4601 (question (if tag "Set ARCHIVE tag (no open TODO items)? "
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4602 "Move subtree to archive (no open TODO items)? "))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4603 beg end (cntarch 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4604 (if (org-on-heading-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4605 (progn
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4606 (setq re1 (concat "^" (regexp-quote
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4607 (make-string
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4608 (1+ (- (match-end 0) (match-beginning 0)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4609 ?*))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4610 " "))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4611 (move-marker begm (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4612 (move-marker endm (org-end-of-subtree)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4613 (setq re1 "^* ")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4614 (move-marker begm (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4615 (move-marker endm (point-max)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4616 (save-excursion
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4617 (goto-char begm)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4618 (while (re-search-forward re1 endm t)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4619 (setq beg (match-beginning 0)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4620 end (save-excursion (org-end-of-subtree t) (point)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4621 (goto-char beg)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4622 (if (re-search-forward re end t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4623 (goto-char end)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4624 (goto-char beg)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4625 (if (and (or (not tag) (not (looking-at rea)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4626 (y-or-n-p question))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4627 (progn
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4628 (if tag
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4629 (org-toggle-tag org-archive-tag 'on)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4630 (org-archive-subtree))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4631 (setq cntarch (1+ cntarch)))
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4632 (goto-char end)))))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4633 (message "%d trees archived" cntarch)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4634
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4635 (defun org-cycle-hide-archived-subtrees (state)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4636 "Re-hide all archived subtrees after a visibility state change."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4637 (when (and (not org-cycle-open-archived-trees)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4638 (not (memq state '(overview folded))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4639 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4640 (let* ((globalp (memq state '(contents all)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4641 (beg (if globalp (point-min) (point)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4642 (end (if globalp (point-max) (org-end-of-subtree))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4643 (org-hide-archived-subtrees beg end)))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4644
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4645 (defun org-hide-archived-subtrees (beg end)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4646 "Re-hide all archived subtrees after a visibility state change."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4647 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4648 (let* ((re (concat ":" org-archive-tag ":")))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4649 (goto-char beg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4650 (while (re-search-forward re end t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4651 (and (org-on-heading-p) (hide-subtree))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4652 (org-end-of-subtree)))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4653
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4654 (defun org-toggle-tag (tag &optional onoff)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4655 "Toggle the tag TAG for the current line.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4656 If ONOFF is `on' or `off', don't toggle but set to this state."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4657 (unless (org-on-heading-p) (error "Not on headling"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4658 (let (res current)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4659 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4660 (beginning-of-line)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4661 (if (re-search-forward "[ \t]:\\([a-zA-Z0-9_@:]+\\):[ \t]*$"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4662 (point-at-eol) t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4663 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4664 (setq current (match-string 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4665 (replace-match ""))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4666 (setq current ""))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4667 (setq current (nreverse (org-split-string current ":")))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4668 (cond
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4669 ((eq onoff 'on)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4670 (setq res t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4671 (or (member tag current) (push tag current)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4672 ((eq onoff 'off)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4673 (or (not (member tag current)) (setq current (delete tag current))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4674 (t (if (member tag current)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4675 (setq current (delete tag current))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4676 (setq res t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4677 (push tag current))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4678 (end-of-line 1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4679 (when current
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4680 (insert " :" (mapconcat 'identity (nreverse current) ":") ":"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4681 (org-set-tags nil t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4682 res))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4683
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4684 (defun org-toggle-archive-tag (&optional arg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4685 "Toggle the archive tag for the current headline.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4686 With prefix ARG, check all children of current headline and offer tagging
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4687 the children that do not contain any open TODO items."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4688 (interactive "P")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4689 (if arg
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4690 (org-archive-all-done 'tag)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4691 (let (set)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4692 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4693 (org-back-to-heading t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4694 (setq set (org-toggle-tag org-archive-tag))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4695 (when set (hide-subtree)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4696 (and set (beginning-of-line 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4697 (message "Subtree %s" (if set "archived" "unarchived")))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4698
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4699 (defun org-prepare-agenda-buffers (files)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4700 "Create buffers for all agenda files, protect archived trees and comments."
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4701 (interactive)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4702 (let ((pa '(:org-archived t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4703 (pc '(:org-comment t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4704 (pall '(:org-archived t :org-comment t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4705 (rea (concat ":" org-archive-tag ":"))
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
4706 bmp file re)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4707 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4708 (while (setq file (pop files))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4709 (org-check-agenda-file file)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4710 (set-buffer (org-get-agenda-file-buffer file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4711 (widen)
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
4712 (setq bmp (buffer-modified-p))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4713 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4714 (remove-text-properties (point-min) (point-max) pall)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4715 (when org-agenda-skip-archived-trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4716 (goto-char (point-min))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4717 (while (re-search-forward rea nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4718 (if (org-on-heading-p)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
4719 (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4720 (goto-char (point-min))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4721 (setq re (concat "^\\*+ +" org-comment-string "\\>"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4722 (while (re-search-forward re nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4723 (add-text-properties
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
4724 (match-beginning 0) (org-end-of-subtree t) pc)))
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
4725 (set-buffer-modified-p bmp)))))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4726
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4727 (defun org-agenda-skip ()
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4728 "Throw to `:skip' in places that should be skipped."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4729 (let ((p (point-at-bol)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4730 (and org-agenda-skip-archived-trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4731 (get-text-property p :org-archived)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4732 (org-end-of-subtree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4733 (throw :skip t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4734 (and (get-text-property p :org-comment)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4735 (org-end-of-subtree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4736 (throw :skip t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4737 (if (equal (char-after p) ?#) (throw :skip t))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4738
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4739 (defun org-agenda-toggle-archive-tag ()
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4740 "Toggle the archive tag for the current entry."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4741 (interactive)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4742 (org-agenda-check-no-diary)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4743 (org-agenda-show) ;;; FIXME This is a stupid hack and should not be needed
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4744 (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4745 (org-agenda-error)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4746 (buffer (marker-buffer hdmarker))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4747 (pos (marker-position hdmarker))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4748 (buffer-read-only nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4749 newhead)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4750 (with-current-buffer buffer
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4751 (widen)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4752 (goto-char pos)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4753 (org-show-hidden-entry)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4754 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4755 (and (outline-next-heading)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4756 (org-flag-heading nil))) ; show the next heading
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4757 (call-interactively 'org-toggle-archive-tag)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4758 (end-of-line 1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4759 (setq newhead (org-get-heading)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4760 (org-agenda-change-all-lines newhead hdmarker)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4761 (beginning-of-line 1)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4762
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4763 ;;; Dynamic blocks
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4764
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4765 (defun org-find-dblock (name)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4766 "Find the first dynamic block with name NAME in the buffer.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4767 If not found, stay at current position and return nil."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4768 (let (pos)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4769 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4770 (goto-char (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4771 (setq pos (and (re-search-forward (concat "^#\\+BEGIN:[ \t]+" name "\\>")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4772 nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4773 (match-beginning 0))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4774 (if pos (goto-char pos))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4775 pos))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4776
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4777 (defconst org-dblock-start-re
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4778 "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4779 "Matches the startline of a dynamic block, with parameters.")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4780
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4781 (defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4782 "Matches the end of a dyhamic block.")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4783
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4784 (defun org-create-dblock (plist)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4785 "Create a dynamic block section, with parameters taken from PLIST.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4786 PLIST must containe a :name entry which is used as name of the block."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4787 (unless (bolp) (newline))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4788 (let ((name (plist-get plist :name)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4789 (insert "#+BEGIN: " name)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4790 (while plist
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4791 (if (eq (car plist) :name)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4792 (setq plist (cddr plist))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4793 (insert " " (prin1-to-string (pop plist)))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4794 (insert "\n\n#+END:\n")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4795 (beginning-of-line -2)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4796
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4797 (defun org-prepare-dblock ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4798 "Prepare dynamic block for refresh.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4799 This empties the block, puts the cursor at the insert position and returns
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4800 the property list including an extra property :name with the block name."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4801 (unless (looking-at org-dblock-start-re)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4802 (error "Not at a dynamic block"))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4803 (let* ((begdel (1+ (match-end 0)))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4804 (name (match-string 1))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4805 (params (append (list :name name)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4806 (read (concat "(" (match-string 2) ")")))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4807 (unless (re-search-forward org-dblock-end-re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4808 (error "Dynamic block not terminated"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4809 (delete-region begdel (match-beginning 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4810 (goto-char begdel)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4811 (open-line 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4812 params))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4813
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4814 (defun org-map-dblocks (&optional command)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4815 "Apply COMMAND to all dynamic blocks in the current buffer.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4816 If COMMAND is not given, use `org-update-dblock'."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4817 (let ((cmd (or command 'org-update-dblock))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4818 pos)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4819 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4820 (goto-char (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4821 (while (re-search-forward org-dblock-start-re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4822 (goto-char (setq pos (match-beginning 0)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4823 (condition-case nil
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4824 (funcall cmd)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4825 (error (message "Error during update of dynamic block")))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4826 (goto-char pos)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4827 (unless (re-search-forward org-dblock-end-re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4828 (error "Dynamic block not terminated"))))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4829
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4830 (defun org-dblock-update (&optional arg)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4831 "User command for updating dynamic blocks.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4832 Update the dynamic block at point. With prefix ARG, update all dynamic
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4833 blocks in the buffer."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4834 (interactive "P")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4835 (if arg
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4836 (org-update-all-dblocks)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4837 (or (looking-at org-dblock-start-re)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4838 (org-beginning-of-dblock))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4839 (org-update-dblock)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4840
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4841 (defun org-update-dblock ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4842 "Update the dynamic block at point
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4843 This means to empty the block, parse for parameters and then call
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4844 the correct writing function."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4845 (let* ((pos (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4846 (params (org-prepare-dblock))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4847 (name (plist-get params :name))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4848 (cmd (intern (concat "org-dblock-write:" name))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4849 (funcall cmd params)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4850 (goto-char pos)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4851
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4852 (defun org-beginning-of-dblock ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4853 "Find the beginning of the dynamic block at point.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4854 Error if there is no scuh block at point."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4855 (let ((pos (point))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
4856 beg)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4857 (end-of-line 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4858 (if (and (re-search-backward org-dblock-start-re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4859 (setq beg (match-beginning 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4860 (re-search-forward org-dblock-end-re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4861 (> (match-end 0) pos))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4862 (goto-char beg)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4863 (goto-char pos)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4864 (error "Not in a dynamic block"))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4865
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4866 (defun org-update-all-dblocks ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4867 "Update all dynamic blocks in the buffer.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4868 This function can be used in a hook."
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
4869 (when (org-mode-p)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4870 (org-map-dblocks 'org-update-dblock)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
4871
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4872
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4873 ;;; Completion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4874
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4875 (defun org-complete (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4876 "Perform completion on word at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4877 At the beginning of a headline, this completes TODO keywords as given in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4878 `org-todo-keywords'.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4879 If the current word is preceded by a backslash, completes the TeX symbols
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4880 that are supported for HTML support.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4881 If the current word is preceded by \"#+\", completes special words for
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4882 setting file options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4883 At all other locations, this simply calls `ispell-complete-word'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4884 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4885 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4886 (let* ((end (point))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4887 (beg1 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4888 (if (equal (char-before (point)) ?\ ) (backward-char 1))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4889 (skip-chars-backward "a-zA-Z_@0-9")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4890 (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4891 (beg (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4892 (if (equal (char-before (point)) ?\ ) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4893 (skip-chars-backward "a-zA-Z0-9_:$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4894 (point)))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4895 (confirm (lambda (x) (stringp (car x))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4896 (camel (equal (char-before beg) ?*))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4897 (tag (equal (char-before beg1) ?:))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4898 (texp (equal (char-before beg) ?\\))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4899 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4900 beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4901 "#+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4902 (completion-ignore-case opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4903 (type nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4904 (tbl nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4905 (table (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4906 (opt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4907 (setq type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4908 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4909 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4910 (cons (match-string 2 x) (match-string 1 x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4911 (org-split-string (org-get-current-options) "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4912 (texp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4913 (setq type :tex)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4914 org-html-entities)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4915 ((string-match "\\`\\*+[ \t]*\\'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4916 (buffer-substring (point-at-bol) beg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4917 (setq type :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4918 (mapcar 'list org-todo-keywords))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4919 (camel
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4920 (setq type :camel)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4921 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4922 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4923 (while (re-search-forward org-todo-line-regexp nil t)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
4924 (push (list
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4925 (if org-file-link-context-use-camel-case
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4926 (org-make-org-heading-camel (match-string 3) t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4927 (org-make-org-heading-search-string
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4928 (match-string 3) t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4929 tbl)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4930 tbl)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4931 (tag (setq type :tag beg beg1)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
4932 (or org-tag-alist (org-get-buffer-tags)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4933 (t (progn (ispell-complete-word arg) (throw 'exit nil)))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4934 (pattern (buffer-substring-no-properties beg end))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4935 (completion (try-completion pattern table confirm)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4936 (cond ((eq completion t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4937 (if (equal type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4938 (insert (substring (cdr (assoc (upcase pattern) table))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4939 (length pattern)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4940 ((null completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4941 (message "Can't find completion for \"%s\"" pattern)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4942 (ding))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4943 ((not (string= pattern completion))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4944 (delete-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4945 (if (string-match " +$" completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4946 (setq completion (replace-match "" t t completion)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4947 (insert completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4948 (if (get-buffer-window "*Completions*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4949 (delete-window (get-buffer-window "*Completions*")))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4950 (if (assoc completion table)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4951 (if (eq type :todo) (insert " ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4952 (if (eq type :tag) (insert ":"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4953 (if (and (equal type :opt) (assoc completion table))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4954 (message "%s" (substitute-command-keys
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4955 "Press \\[org-complete] again to insert example settings"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4956 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4957 (message "Making completion list...")
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4958 (let ((list (sort (all-completions pattern table confirm)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
4959 'string<)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4960 (with-output-to-temp-buffer "*Completions*"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4961 (condition-case nil
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4962 ;; Protection needed for XEmacs and emacs 21
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4963 (display-completion-list list pattern)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4964 (error (display-completion-list list)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4965 (message "Making completion list...%s" "done"))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4966
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4967 ;;; Comments, TODO and DEADLINE
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4968
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4969 (defun org-toggle-comment ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4970 "Change the COMMENT state of an entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4971 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4972 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4973 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4974 (if (looking-at (concat outline-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4975 "\\( +\\<" org-comment-string "\\>\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4976 (replace-match "" t t nil 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4977 (if (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4978 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4979 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4980 (insert " " org-comment-string))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4981
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4982 (defvar org-last-todo-state-is-todo nil
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4983 "This is non-nil when the last TODO state change led to a TODO state.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4984 If the last change removed the TODO tag or switched to DONE, then
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4985 this is nil.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4986
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4987 (defun org-todo (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4988 "Change the TODO state of an item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4989 The state of an item is given by a keyword at the start of the heading,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4990 like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4991 *** TODO Write paper
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4992 *** DONE Call mom
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4993
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4994 The different keywords are specified in the variable `org-todo-keywords'.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4995 By default the available states are \"TODO\" and \"DONE\".
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4996 So for this example: when the item starts with TODO, it is changed to DONE.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4997 When it starts with DONE, the DONE is removed. And when neither TODO nor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4998 DONE are present, add TODO at the beginning of the heading.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4999
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5000 With prefix arg, use completion to determine the new state. With numeric
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5001 prefix arg, switch to that state."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5002 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5003 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5004 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5005 (if (looking-at outline-regexp) (goto-char (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5006 (or (looking-at (concat " +" org-todo-regexp " *"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5007 (looking-at " *"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5008 (let* ((this (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5009 (completion-ignore-case t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5010 (member (member this org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5011 (tail (cdr member))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5012 (state (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5013 ((equal arg '(4))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5014 ;; Read a state with completion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5015 (completing-read "State: " (mapcar (lambda(x) (list x))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5016 org-todo-keywords)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5017 nil t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5018 ((eq arg 'right)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5019 (if this
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5020 (if tail (car tail) nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5021 (car org-todo-keywords)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5022 ((eq arg 'left)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5023 (if (equal member org-todo-keywords)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5024 nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5025 (if this
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5026 (nth (- (length org-todo-keywords) (length tail) 2)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5027 org-todo-keywords)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5028 org-done-string)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5029 (arg
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5030 ;; user requests a specific state
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5031 (nth (1- (prefix-numeric-value arg))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5032 org-todo-keywords))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5033 ((null member) (car org-todo-keywords))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5034 ((null tail) nil) ;; -> first entry
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5035 ((eq org-todo-interpretation 'sequence)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5036 (car tail))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5037 ((memq org-todo-interpretation '(type priority))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5038 (if (eq this-command last-command)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5039 (car tail)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5040 (if (> (length tail) 0) org-done-string nil)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5041 (t nil)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5042 (next (if state (concat " " state " ") " ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5043 (replace-match next t t)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5044 (setq org-last-todo-state-is-todo
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5045 (not (equal state org-done-string)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5046 (when org-log-done
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5047 (if (equal state org-done-string)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5048 (org-add-planning-info 'closed (current-time) 'scheduled)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5049 (if (not this)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5050 (org-add-planning-info nil nil 'closed))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5051 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5052 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5053 (run-hooks 'org-after-todo-state-change-hook)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5054 ;; Fixup cursor location if close to the keyword
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5055 (if (and (outline-on-heading-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5056 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5057 (save-excursion (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5058 (looking-at org-todo-line-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5059 (< (point) (+ 2 (or (match-end 2) (match-end 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5060 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5061 (goto-char (or (match-end 2) (match-end 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5062 (just-one-space))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5063
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5064 (defun org-log-done (&optional undone)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5065 "Add a time stamp logging that a TODO entry has been closed.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5066 When UNDONE is non-nil, remove such a time stamp again."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5067 (interactive)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5068 (let (beg end col)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5069 (save-excursion
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5070 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5071 (setq beg (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5072 (looking-at (concat outline-regexp " *"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5073 (goto-char (match-end 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5074 (setq col (current-column))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5075 (outline-next-heading)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5076 (setq end (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5077 (goto-char beg)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5078 (when (re-search-forward (concat
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5079 "[\r\n]\\([ \t]*"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5080 (regexp-quote org-closed-string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5081 " *\\[.*?\\][^\n\r]*[\n\r]?\\)") end t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5082 (delete-region (match-beginning 1) (match-end 1)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5083 (unless undone
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5084 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5085 (skip-chars-forward "^\n\r")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5086 (goto-char (min (1+ (point)) (point-max)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5087 (when (not (member (char-before) '(?\r ?\n)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5088 (insert "\n"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5089 (indent-to col)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5090 (insert org-closed-string " "
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5091 (format-time-string
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5092 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5093 (org-current-time))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5094 "\n")))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5095
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5096 (defun org-show-todo-tree (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5097 "Make a compact tree which shows all headlines marked with TODO.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5098 The tree will show the lines where the regexp matches, and all higher
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5099 headlines above the match.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5100 With \\[universal-argument] prefix, also show the DONE entries.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5101 With a numeric prefix N, construct a sparse tree for the Nth element
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5102 of `org-todo-keywords'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5103 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5104 (let ((case-fold-search nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5105 (kwd-re
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5106 (cond ((null arg) org-not-done-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5107 ((equal arg '(4)) org-todo-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5108 ((<= (prefix-numeric-value arg) (length org-todo-keywords))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5109 (regexp-quote (nth (1- (prefix-numeric-value arg))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5110 org-todo-keywords)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5111 (t (error "Invalid prefix argument: %s" arg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5112 (message "%d TODO entries found"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5113 (org-occur (concat "^" outline-regexp " +" kwd-re )))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5114
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5115 (defun org-deadline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5116 "Insert the DEADLINE: string to make a deadline.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5117 A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5118 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5119 (interactive)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5120 (org-add-planning-info 'deadline nil 'closed))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5121
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5122 (defun org-schedule ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5123 "Insert the SCHEDULED: string to schedule a TODO item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5124 A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5125 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5126 (interactive)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5127 (org-add-planning-info 'scheduled nil 'closed))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5128
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5129 (defun org-add-planning-info (what &optional time &rest remove)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5130 "Insert new timestamp with keyword in the line directly after the headline.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5131 WHAT indicates what kind of time stamp to add. TIME indicated the time to use.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5132 If non is given, the user is prompted for a date.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5133 REMOVE indicates what kind of entries to remove. An old WHAT entry will also
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5134 be removed."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5135 (interactive)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5136 (when what (setq time (or time (org-read-date nil 'to-time))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5137 (when (and org-insert-labeled-timestamps-at-point
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5138 (member what '(scheduled deadline)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5139 (insert
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5140 (if (eq what 'scheduled) org-scheduled-string org-deadline-string)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5141 " "
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5142 (format-time-string (car org-time-stamp-formats) time))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5143 (setq what nil))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5144 (save-excursion
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5145 (let (col list elt (buffer-invisibility-spec nil) ts)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5146 (org-back-to-heading t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5147 (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5148 (goto-char (match-end 1))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5149 (setq col (current-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5150 (goto-char (1+ (match-end 0)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5151 (if (and (not (looking-at outline-regexp))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5152 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5153 "[^\r\n]*"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5154 (not (equal (match-string 1) org-clock-string)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5155 (narrow-to-region (match-beginning 0) (match-end 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5156 (insert "\n")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5157 (backward-char 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5158 (narrow-to-region (point) (point))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5159 (indent-to-column col))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5160 ;; Check if we have to remove something.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5161 (setq list (cons what remove))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5162 (while list
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5163 (setq elt (pop list))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5164 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5165 (when (or (and (eq elt 'scheduled)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5166 (re-search-forward org-scheduled-time-regexp nil t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5167 (and (eq elt 'deadline)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5168 (re-search-forward org-deadline-time-regexp nil t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5169 (and (eq elt 'closed)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5170 (re-search-forward org-closed-time-regexp nil t)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5171 (replace-match "")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5172 (if (looking-at " +") (replace-match ""))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5173 (goto-char (point-max))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5174 (when what
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5175 (insert
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5176 (if (not (equal (char-before) ?\ )) " " "")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5177 (cond ((eq what 'scheduled) org-scheduled-string)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5178 ((eq what 'deadline) org-deadline-string)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5179 ((eq what 'closed) org-closed-string))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5180 " ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5181 (insert
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5182 (setq ts
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5183 (format-time-string
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5184 (if (eq what 'closed)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5185 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5186 (car org-time-stamp-formats))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5187 time))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5188 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5189 (widen)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5190 (if (looking-at "[ \t]+\r?\n")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5191 (replace-match ""))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5192 ts)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5193
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5194 (defun org-occur (regexp &optional callback)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5195 "Make a compact tree which shows all matches of REGEXP.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5196 The tree will show the lines where the regexp matches, and all higher
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5197 headlines above the match. It will also show the heading after the match,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5198 to make sure editing the matching entry is easy.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5199 If CALLBACK is non-nil, it is a function which is called to confirm
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5200 that the match should indeed be shown."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5201 (interactive "sRegexp: ")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5202 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5203 (setq regexp (org-check-occur-regexp regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5204 (let ((cnt 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5205 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5206 (goto-char (point-min))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5207 (org-overview)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5208 (while (re-search-forward regexp nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5209 (when (or (not callback)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5210 (save-match-data (funcall callback)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5211 (setq cnt (1+ cnt))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5212 (org-highlight-new-match (match-beginning 0) (match-end 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5213 (org-show-hierarchy-above))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5214 (org-add-hook 'before-change-functions 'org-remove-occur-highlights
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5215 nil 'local)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5216 (unless org-sparse-tree-open-archived-trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5217 (org-hide-archived-subtrees (point-min) (point-max)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5218 (run-hooks 'org-occur-hook)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5219 (if (interactive-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5220 (message "%d match(es) for regexp %s" cnt regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5221 cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5222
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5223 (defun org-show-hierarchy-above ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5224 "Make sure point and the headings hierarchy above is visible."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5225 (catch 'exit
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5226 (if (org-on-heading-p t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5227 (org-flag-heading nil) ; only show the heading
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5228 (and (or (org-invisible-p) (org-invisible-p2))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5229 (org-show-hidden-entry))) ; show entire entry
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5230 (save-excursion
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5231 (and org-show-following-heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5232 (outline-next-heading)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5233 (org-flag-heading nil))) ; show the next heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5234 (when org-show-hierarchy-above
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5235 (save-excursion ; show all higher headings
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5236 (while (and (condition-case nil
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5237 (progn (org-up-heading-all 1) t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5238 (error nil))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5239 (not (bobp)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5240 (org-flag-heading nil))))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5241
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5242 ;; Overlay compatibility functions
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5243 (defun org-make-overlay (beg end &optional buffer)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5244 (if (featurep 'xemacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5245 (make-extent beg end buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5246 (make-overlay beg end buffer)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5247 (defun org-delete-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5248 (if (featurep 'xemacs) (delete-extent ovl) (delete-overlay ovl)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5249 (defun org-detatch-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5250 (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5251 (defun org-move-overlay (ovl beg end &optional buffer)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5252 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5253 (set-extent-endpoints ovl beg end buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5254 (move-overlay ovl beg end buffer)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5255 (defun org-overlay-put (ovl prop value)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5256 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5257 (set-extent-property ovl prop value)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5258 (overlay-put ovl prop value)))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5259 (defun org-overlays-at (pos)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5260 (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5261 (defun org-overlay-start (o)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5262 (if (featurep 'xemacs) (extent-start-position o) (overlay-start o)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5263 (defun org-overlay-end (o)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
5264 (if (featurep 'xemacs) (extent-end-position o) (overlay-end o)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5265
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5266 (defvar org-occur-highlights nil)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5267 (make-variable-buffer-local 'org-occur-highlights)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5268 (defun org-highlight-new-match (beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5269 "Highlight from BEG to END and mark the highlight is an occur headline."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5270 (let ((ov (org-make-overlay beg end)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5271 (org-overlay-put ov 'face 'secondary-selection)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5272 (push ov org-occur-highlights)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5273
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5274 (defvar org-inhibit-highlight-removal nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5275 (defun org-remove-occur-highlights (&optional beg end noremove)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5276 "Remove the occur highlights from the buffer.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5277 BEG and END are ignored. If NOREMOVE is nil, remove this function
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5278 from the `before-change-functions' in the current buffer."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5279 (interactive)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5280 (unless org-inhibit-highlight-removal
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5281 (mapc 'org-delete-overlay org-occur-highlights)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5282 (setq org-occur-highlights nil)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5283 (unless noremove
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5284 (remove-hook 'before-change-functions
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5285 'org-remove-occur-highlights 'local))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5286
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5287 ;;; Priorities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5288
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5289 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5290 "Regular expression matching the priority indicator.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5291
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5292 (defvar org-remove-priority-next-time nil)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5293
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5294 (defun org-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5295 "Increase the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5296 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5297 (org-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5298
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5299 (defun org-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5300 "Decrease the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5301 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5302 (org-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5303
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5304 (defun org-priority (&optional action)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5305 "Change the priority of an item by ARG.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5306 ACTION can be set, up, or down."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5307 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5308 (setq action (or action 'set))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5309 (let (current new news have remove)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5310 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5311 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5312 (if (looking-at org-priority-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5313 (setq current (string-to-char (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5314 have t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5315 (setq current org-default-priority))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5316 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5317 ((eq action 'set)
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
5318 (message "Priority A-%c, SPC to remove: " org-lowest-priority)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5319 (setq new (read-char-exclusive))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5320 (cond ((equal new ?\ ) (setq remove t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5321 ((or (< (upcase new) ?A) (> (upcase new) org-lowest-priority))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5322 (error "Priority must be between `%c' and `%c'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5323 ?A org-lowest-priority))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5324 ((eq action 'up)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5325 (setq new (1- current)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5326 ((eq action 'down)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5327 (setq new (1+ current)))
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59596
diff changeset
5328 (t (error "Invalid action")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5329 (setq new (min (max ?A (upcase new)) org-lowest-priority))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5330 (setq news (format "%c" new))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5331 (if have
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5332 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5333 (replace-match "" t t nil 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5334 (replace-match news t t nil 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5335 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5336 (error "No priority cookie found in line")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5337 (looking-at org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5338 (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5339 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5340 (goto-char (match-end 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5341 (insert " [#" news "]"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5342 (goto-char (match-beginning 3))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5343 (insert "[#" news "] ")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5344 (if remove
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5345 (message "Priority removed")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5346 (message "Priority of current item set to %s" news))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5347
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5348
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5349 (defun org-get-priority (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5350 "Find priority cookie and return priority."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5351 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5352 (if (not (string-match org-priority-regexp s))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5353 (* 1000 (- org-lowest-priority org-default-priority))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5354 (* 1000 (- org-lowest-priority
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5355 (string-to-char (match-string 2 s)))))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5356
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5357 ;;; Timestamps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5358
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5359 (defvar org-last-changed-timestamp nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5360
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5361 (defun org-time-stamp (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5362 "Prompt for a date/time and insert a time stamp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5363 If the user specifies a time like HH:MM, or if this command is called
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5364 with a prefix argument, the time stamp will contain date and time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5365 Otherwise, only the date will be included. All parts of a date not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5366 specified by the user will be filled in from the current date/time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5367 So if you press just return without typing anything, the time stamp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5368 will represent the current date/time. If there is already a timestamp
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
5369 at the cursor, it will be modified."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5370 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5371 (let ((fmt (if arg (cdr org-time-stamp-formats)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5372 (car org-time-stamp-formats)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5373 (org-time-was-given nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5374 time)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5375 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5376 ((and (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5377 (eq last-command 'org-time-stamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5378 (eq this-command 'org-time-stamp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5379 (insert "--")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5380 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5381 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5382 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5383 (insert (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5384 ((org-at-timestamp-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5385 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5386 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5387 (and (org-at-timestamp-p) (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5388 (setq org-last-changed-timestamp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5389 (format-time-string fmt time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5390 t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5391 (message "Timestamp updated"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5392 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5393 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5394 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5395 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5396 (insert (format-time-string fmt time))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5397
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5398 (defun org-time-stamp-inactive (&optional arg)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5399 "Insert an inactive time stamp.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5400 An inactive time stamp is enclosed in square brackets instead of angle
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5401 brackets. It is inactive in the sense that it does not trigger agenda entries,
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5402 does not link to the calendar and cannot be changed with the S-cursor keys.
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5403 So these are more for recording a certain time/date."
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5404 (interactive "P")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5405 (let ((fmt (if arg (cdr org-time-stamp-formats)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5406 (car org-time-stamp-formats)))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5407 (org-time-was-given nil)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5408 time)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5409 (setq time (org-read-date arg 'totime))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5410 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5411 (setq fmt (concat "[" (substring fmt 1 -1) "]"))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5412 (insert (format-time-string fmt time))))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
5413
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5414 (defvar org-date-ovl (org-make-overlay 1 1))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5415 (org-overlay-put org-date-ovl 'face 'org-warning)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5416 (org-detatch-overlay org-date-ovl)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5417
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5418 (defun org-read-date (&optional with-time to-time)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5419 "Read a date and make things smooth for the user.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5420 The prompt will suggest to enter an ISO date, but you can also enter anything
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5421 which will at least partially be understood by `parse-time-string'.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5422 Unrecognized parts of the date will default to the current day, month, year,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5423 hour and minute. For example,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5424 3-2-5 --> 2003-02-05
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5425 feb 15 --> currentyear-02-15
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5426 sep 12 9 --> 2009-09-12
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5427 12:45 --> today 12:45
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5428 22 sept 0:34 --> currentyear-09-22 0:34
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5429 12 --> currentyear-currentmonth-12
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5430 Fri --> nearest Friday (today or later)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5431 etc.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5432 The function understands only English month and weekday abbreviations,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5433 but this can be configured with the variables `parse-time-months' and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5434 `parse-time-weekdays'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5435
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5436 While prompting, a calendar is popped up - you can also select the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5437 date with the mouse (button 1). The calendar shows a period of three
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5438 months. To scroll it to other months, use the keys `>' and `<'.
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5439 If you don't like the calendar, turn it off with
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5440 \(setq org-popup-calendar-for-date-prompt nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5441
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5442 With optional argument TO-TIME, the date will immediately be converted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5443 to an internal time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5444 With an optional argument WITH-TIME, the prompt will suggest to also
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5445 insert a time. Note that when WITH-TIME is not set, you can still
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5446 enter a time, and this function will inform the calling routine about
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5447 this change. The calling routine may then choose to change the format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5448 used to insert the time stamp into the buffer to include the time."
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
5449 (require 'parse-time)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5450 (let* ((org-time-stamp-rounding-minutes
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5451 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5452 (ct (org-current-time))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5453 (default-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5454 ;; Default time is either today, or, when entering a range,
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5455 ;; the range start.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5456 (if (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5457 (re-search-backward
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
5458 (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5459 (- (point) 20) t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5460 (apply
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5461 'encode-time
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5462 (mapcar (lambda(x) (or x 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5463 (parse-time-string (match-string 1))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5464 ct))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5465 (calendar-move-hook nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
5466 (view-diary-entries-initially nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
5467 (view-calendar-holidays-initially nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5468 (timestr (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5469 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5470 (prompt (format "YYYY-MM-DD [%s]: " timestr))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5471 ans ans1 ans2
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5472 second minute hour day month year tl wday wday1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5473
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5474 (if org-popup-calendar-for-date-prompt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5475 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5476 (save-window-excursion
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5477 (calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5478 (calendar-forward-day (- (time-to-days default-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5479 (calendar-absolute-from-gregorian
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5480 (calendar-current-date))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5481 (org-eval-in-calendar nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5482 (let* ((old-map (current-local-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5483 (map (copy-keymap calendar-mode-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5484 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5485 (define-key map (kbd "RET") 'org-calendar-select)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5486 (define-key map (if (featurep 'xemacs) [button1] [mouse-1])
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5487 'org-calendar-select-mouse)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5488 (define-key map (if (featurep 'xemacs) [button2] [mouse-2])
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5489 'org-calendar-select-mouse)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5490 (define-key minibuffer-local-map [(meta shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5491 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5492 (org-eval-in-calendar '(calendar-backward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5493 (define-key minibuffer-local-map [(meta shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5494 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5495 (org-eval-in-calendar '(calendar-forward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5496 (define-key minibuffer-local-map [(shift up)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5497 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5498 (org-eval-in-calendar '(calendar-backward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5499 (define-key minibuffer-local-map [(shift down)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5500 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5501 (org-eval-in-calendar '(calendar-forward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5502 (define-key minibuffer-local-map [(shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5503 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5504 (org-eval-in-calendar '(calendar-backward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5505 (define-key minibuffer-local-map [(shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5506 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5507 (org-eval-in-calendar '(calendar-forward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5508 (define-key minibuffer-local-map ">"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5509 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5510 (org-eval-in-calendar '(scroll-calendar-left 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5511 (define-key minibuffer-local-map "<"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5512 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5513 (org-eval-in-calendar '(scroll-calendar-right 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5514 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5515 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5516 (use-local-map map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5517 (setq ans (read-string prompt "" nil nil))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5518 (if (not (string-match "\\S-" ans)) (setq ans nil))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
5519 (setq ans (or ans1 ans ans2)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5520 (use-local-map old-map)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5521 ;; Naked prompt only
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5522 (setq ans (read-string prompt "" nil timestr)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5523 (org-detatch-overlay org-date-ovl)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5524
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5525 (if (string-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5526 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5527 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5528 (setq year (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5529 (string-to-number (match-string 2 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5530 (string-to-number (format-time-string "%Y")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5531 month (string-to-number (match-string 3 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5532 day (string-to-number (match-string 4 ans)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5533 (if (< year 100) (setq year (+ 2000 year)))
69531
b1e915361a06 (org-read-date): Include subgroup 5 into
Carsten Dominik <dominik@science.uva.nl>
parents: 69482
diff changeset
5534 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
b1e915361a06 (org-read-date): Include subgroup 5 into
Carsten Dominik <dominik@science.uva.nl>
parents: 69482
diff changeset
5535 t nil ans))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5536 (setq tl (parse-time-string ans)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5537 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5538 month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5539 day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5540 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5541 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5542 second (or (nth 0 tl) 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5543 wday (nth 6 tl))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5544 (when (and wday (not (nth 3 tl)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5545 ;; Weekday was given, but no day, so pick that day in the week
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5546 ;; on or after the derived date.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5547 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5548 (unless (equal wday wday1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5549 (setq day (+ day (% (- wday wday1 -7) 7)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5550 (if (and (boundp 'org-time-was-given)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5551 (nth 2 tl))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5552 (setq org-time-was-given t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5553 (if (< year 100) (setq year (+ 2000 year)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5554 (if to-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5555 (encode-time second minute hour day month year)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5556 (if (or (nth 1 tl) (nth 2 tl))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5557 (format "%04d-%02d-%02d %02d:%02d" year month day hour minute)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5558 (format "%04d-%02d-%02d" year month day)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5559
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5560 (defun org-eval-in-calendar (form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5561 "Eval FORM in the calendar window and return to current window.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5562 Also, store the cursor date in variable ans2."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5563 (let ((sw (selected-window)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5564 (select-window (get-buffer-window "*Calendar*"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5565 (eval form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5566 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5567 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5568 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5569 (setq ans2 (format-time-string "%Y-%m-%d" time))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5570 (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5571 (select-window sw)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5572
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5573 (defun org-calendar-select ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5574 "Return to `org-read-date' with the date currently selected.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5575 This is used by `org-read-date' in a temporary keymap for the calendar buffer."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5576 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5577 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5578 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5579 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5580 (setq ans1 (format-time-string "%Y-%m-%d" time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5581 (if (active-minibuffer-window) (exit-minibuffer))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5582
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5583 (defun org-calendar-select-mouse (ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5584 "Return to `org-read-date' with the date currently selected.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5585 This is used by `org-read-date' in a temporary keymap for the calendar buffer."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5586 (interactive "e")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5587 (mouse-set-point ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5588 (when (calendar-cursor-to-date)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5589 (let* ((date (calendar-cursor-to-date))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5590 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5591 (setq ans1 (format-time-string "%Y-%m-%d" time)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5592 (if (active-minibuffer-window) (exit-minibuffer))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5593
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5594 (defun org-check-deadlines (ndays)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5595 "Check if there are any deadlines due or past due.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5596 A deadline is considered due if it happens within `org-deadline-warning-days'
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5597 days from today's date. If the deadline appears in an entry marked DONE,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5598 it is not shown. The prefix arg NDAYS can be used to test that many
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5599 days. If the prefix is a raw \\[universal-argument] prefix, all deadlines are shown."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5600 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5601 (let* ((org-warn-days
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5602 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5603 ((equal ndays '(4)) 100000)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5604 (ndays (prefix-numeric-value ndays))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5605 (t org-deadline-warning-days)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5606 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5607 (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5608 (callback
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5609 (lambda ()
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5610 (and (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5611 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5612 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5613 (< (- d2 d1) org-warn-days))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5614 (not (org-entry-is-done-p))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5615 (message "%d deadlines past-due or due within %d days"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5616 (org-occur regexp callback)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5617 org-warn-days)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5618
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5619 (defun org-evaluate-time-range (&optional to-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5620 "Evaluate a time range by computing the difference between start and end.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5621 Normally the result is just printed in the echo area, but with prefix arg
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5622 TO-BUFFER, the result is inserted just after the date stamp into the buffer.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5623 If the time range is actually in a table, the result is inserted into the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5624 next column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5625 For time difference computation, a year is assumed to be exactly 365
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5626 days in order to avoid rounding problems."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5627 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5628 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5629 (unless (org-at-date-range-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5630 (goto-char (point-at-bol))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5631 (re-search-forward org-tr-regexp (point-at-eol) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5632 (if (not (org-at-date-range-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5633 (error "Not at a time-stamp range, and none found in current line")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5634 (let* ((ts1 (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5635 (ts2 (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5636 (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5637 (match-end (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5638 (time1 (org-time-string-to-time ts1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5639 (time2 (org-time-string-to-time ts2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5640 (t1 (time-to-seconds time1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5641 (t2 (time-to-seconds time2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5642 (diff (abs (- t2 t1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5643 (negative (< (- t2 t1) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5644 ;; (ys (floor (* 365 24 60 60)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5645 (ds (* 24 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5646 (hs (* 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5647 (fy "%dy %dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5648 (fy1 "%dy %dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5649 (fd "%dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5650 (fd1 "%dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5651 (fh "%02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5652 y d h m align)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5653 (if havetime
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5654 (setq ; y (floor (/ diff ys)) diff (mod diff ys)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5655 y 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5656 d (floor (/ diff ds)) diff (mod diff ds)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5657 h (floor (/ diff hs)) diff (mod diff hs)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5658 m (floor (/ diff 60)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5659 (setq ; y (floor (/ diff ys)) diff (mod diff ys)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5660 y 0
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5661 d (floor (+ (/ diff ds) 0.5))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5662 h 0 m 0))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5663 (if (not to-buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5664 (message (org-make-tdiff-string y d h m))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5665 (when (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5666 (goto-char match-end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5667 (setq align t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5668 (and (looking-at " *|") (goto-char (match-end 0))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5669 (if (looking-at
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5670 "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5671 (replace-match ""))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5672 (if negative (insert " -"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5673 (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5674 (if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5675 (insert " " (format fh h m))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5676 (if align (org-table-align))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5677 (message "Time difference inserted"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5678
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5679 (defun org-make-tdiff-string (y d h m)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5680 (let ((fmt "")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5681 (l nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5682 (if (> y 0) (setq fmt (concat fmt "%d year" (if (> y 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5683 l (push y l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5684 (if (> d 0) (setq fmt (concat fmt "%d day" (if (> d 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5685 l (push d l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5686 (if (> h 0) (setq fmt (concat fmt "%d hour" (if (> h 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5687 l (push h l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5688 (if (> m 0) (setq fmt (concat fmt "%d minute" (if (> m 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5689 l (push m l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5690 (apply 'format fmt (nreverse l))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5691
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5692 (defun org-time-string-to-time (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5693 (apply 'encode-time (org-parse-time-string s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5694
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5695 (defun org-parse-time-string (s &optional nodefault)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5696 "Parse the standard Org-mode time string.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5697 This should be a lot faster than the normal `parse-time-string'.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5698 If time is not given, defaults to 0:00. However, with optional NODEFAULT,
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5699 hour and minute fields will be nil if not given."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5700 (if (string-match org-ts-regexp1 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5701 (list 0
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5702 (if (or (match-beginning 8) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5703 (string-to-number (or (match-string 8 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5704 (if (or (match-beginning 7) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5705 (string-to-number (or (match-string 7 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5706 (string-to-number (match-string 4 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5707 (string-to-number (match-string 3 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5708 (string-to-number (match-string 2 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5709 nil nil nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5710 (make-list 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5711
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5712 (defun org-timestamp-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5713 "Increase the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5714 If the cursor is on the year, change the year. If it is on the month or
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5715 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5716 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5717 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5718 (org-timestamp-change (prefix-numeric-value arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5719
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5720 (defun org-timestamp-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5721 "Decrease the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5722 If the cursor is on the year, change the year. If it is on the month or
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5723 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5724 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5725 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5726 (org-timestamp-change (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5727
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5728 (defun org-timestamp-up-day (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5729 "Increase the date in the time stamp by one day.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5730 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5731 (interactive "p")
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5732 (if (and (not (org-at-timestamp-p t))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5733 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5734 (org-todo 'up)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5735 (org-timestamp-change (prefix-numeric-value arg) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5736
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5737 (defun org-timestamp-down-day (&optional arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5738 "Decrease the date in the time stamp by one day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5739 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5740 (interactive "p")
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5741 (if (and (not (org-at-timestamp-p t))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5742 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5743 (org-todo 'down)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5744 (org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5745
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5746 (defsubst org-pos-in-match-range (pos n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5747 (and (match-beginning n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5748 (<= (match-beginning n) pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5749 (>= (match-end n) pos)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5750
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5751 (defun org-at-timestamp-p (&optional also-inactive)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5752 "Determine if the cursor is in or at a timestamp."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5753 (interactive)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5754 (let* ((tsr (if also-inactive org-ts-regexp3 org-ts-regexp2))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5755 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5756 (ans (or (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5757 (save-excursion
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5758 (skip-chars-backward "^[<\n\r\t")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5759 (if (> (point) 1) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5760 (and (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5761 (> (- (match-end 0) pos) -1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5762 (and (boundp 'org-ts-what)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5763 (setq org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5764 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5765 ((org-pos-in-match-range pos 2) 'year)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5766 ((org-pos-in-match-range pos 3) 'month)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5767 ((org-pos-in-match-range pos 7) 'hour)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5768 ((org-pos-in-match-range pos 8) 'minute)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5769 ((or (org-pos-in-match-range pos 4)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5770 (org-pos-in-match-range pos 5)) 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5771 (t 'day))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5772 ans))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5773
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5774 (defun org-timestamp-change (n &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5775 "Change the date in the time stamp at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5776 The date will be changed by N times WHAT. WHAT can be `day', `month',
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5777 `year', `minute', `second'. If WHAT is not given, the cursor position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5778 in the timestamp determines what will be changed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5779 (let ((fmt (car org-time-stamp-formats))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5780 org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5781 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5782 ts time time0)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5783 (if (not (org-at-timestamp-p t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5784 (error "Not at a timestamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5785 (setq org-ts-what (or what org-ts-what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5786 (setq fmt (if (<= (abs (- (cdr org-ts-lengths)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5787 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5788 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5789 (cdr org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5790 (car org-time-stamp-formats)))
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5791 (if (= (char-after (match-beginning 0)) ?\[)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
5792 (setq fmt (concat "[" (substring fmt 1 -1) "]")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5793 (setq ts (match-string 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5794 (replace-match "")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5795 (setq time0 (org-parse-time-string ts))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5796 (setq time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5797 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5798 (append
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5799 (list (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5800 (list (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5801 (list (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5802 (list (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5803 (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5804 (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5805 (nthcdr 6 time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5806 (if (eq what 'calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5807 (let ((cal-date
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5808 (save-excursion
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5809 (save-match-data
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5810 (set-buffer "*Calendar*")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5811 (calendar-cursor-to-date)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5812 (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5813 (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5814 (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5815 (setcar time0 (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5816 (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5817 (setcar (nthcdr 2 time0) (or (nth 1 time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5818 (setq time (apply 'encode-time time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5819 (insert (setq org-last-changed-timestamp (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5820 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5821 ;; Try to recenter the calendar window, if any
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5822 (if (and org-calendar-follow-timestamp-change
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5823 (get-buffer-window "*Calendar*" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5824 (memq org-ts-what '(day month year)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5825 (org-recenter-calendar (time-to-days time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5826
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5827 (defun org-recenter-calendar (date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5828 "If the calendar is visible, recenter it to DATE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5829 (let* ((win (selected-window))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5830 (cwin (get-buffer-window "*Calendar*" t))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5831 (calendar-move-hook nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5832 (when cwin
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5833 (select-window cwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5834 (calendar-goto-date (if (listp date) date
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5835 (calendar-gregorian-from-absolute date)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5836 (select-window win))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5837
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5838 (defun org-goto-calendar (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5839 "Go to the Emacs calendar at the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5840 If there is a time stamp in the current line, go to that date.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5841 A prefix ARG can be used to force the current date."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5842 (interactive "P")
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5843 (let ((tsr org-ts-regexp) diff
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5844 (calendar-move-hook nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
5845 (view-calendar-holidays-initially nil)
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5846 (view-diary-entries-initially nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5847 (if (or (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5848 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5849 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5850 (looking-at (concat ".*" tsr))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5851 (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5852 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5853 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5854 (setq diff (- d2 d1))))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
5855 (calendar)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5856 (calendar-goto-today)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5857 (if (and diff (not arg)) (calendar-forward-day diff))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5858
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5859 (defun org-date-from-calendar ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5860 "Insert time stamp corresponding to cursor date in *Calendar* buffer.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5861 If there is already a time stamp at the cursor position, update it."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5862 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5863 (org-timestamp-change 0 'calendar))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5864
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5865 ;;; The clock for measuring work time.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5866
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5867 (defvar org-clock-marker (make-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5868 "Marker recording the last clock-in.")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5869
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5870 (defun org-clock-in ()
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5871 "Start the clock on the current item.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5872 If necessary, clock-out of the currently active clock."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5873 (interactive)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5874 (org-clock-out t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5875 (let (ts)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5876 (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5877 (org-back-to-heading t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5878 (beginning-of-line 2)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5879 (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5880 (not (equal (match-string 1) org-clock-string)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5881 (beginning-of-line 1))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5882 (insert "\n") (backward-char 1)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5883 (indent-relative)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5884 (insert org-clock-string " "
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5885 (setq ts (concat "[" (format-time-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5886 (substring
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5887 (cdr org-time-stamp-formats) 1 -1)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5888 (current-time))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5889 "]")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5890 (move-marker org-clock-marker (point))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5891 (message "Clock started at %s" ts))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5892
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5893 (defun org-clock-out (&optional fail-quietly)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5894 "Stop the currently running clock.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5895 If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5896 (interactive)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5897 (catch 'exit
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5898 (if (not (marker-buffer org-clock-marker))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5899 (if fail-quietly (throw 'exit t) (error "No active clock")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5900 (let (ts te s h m)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5901 (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5902 (set-buffer (marker-buffer org-clock-marker))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5903 (goto-char org-clock-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5904 (beginning-of-line 1)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5905 (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5906 (equal (match-string 1) org-clock-string))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5907 (setq ts (match-string 2))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5908 (if fail-quietly (throw 'exit nil) (error "Clock start time is gone")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5909 (goto-char org-clock-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5910 (setq te (concat "[" (format-time-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5911 (substring
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5912 (cdr org-time-stamp-formats) 1 -1)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5913 (current-time))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5914 "]"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5915 (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5916 (time-to-seconds (apply 'encode-time (org-parse-time-string ts))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5917 h (floor (/ s 3600))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5918 s (- s (* 3600 h))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5919 m (floor (/ s 60))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5920 s (- s (* 60 s)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5921 (insert "--" te " => " (format "%2d:%02d" h m))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5922 (move-marker org-clock-marker nil)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5923 (message "Clock stopped at %s after HH:MM = %d:%02d" te h m)))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5924
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5925 (defun org-clock-cancel ()
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5926 "Cancel the running clock be removing the start timestamp."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5927 (interactive)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5928 (if (not (marker-buffer org-clock-marker))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5929 (error "No active clock"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5930 (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5931 (set-buffer (marker-buffer org-clock-marker))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5932 (goto-char org-clock-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5933 (delete-region (1- (point-at-bol)) (point-at-eol)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5934 (message "Clock canceled"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5935
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5936 (defvar org-clock-file-total-minutes nil
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5937 "Holds the file total time in minutes, after a call to `org-clock-sum'.")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5938 (make-variable-buffer-local 'org-clock-file-total-minutes)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5939
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5940 (defun org-clock-sum ()
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5941 "Sum the times for each subtree.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5942 Puts the resulting times in minutes as a text property on each headline."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5943 (interactive)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5944 (let* ((bmp (buffer-modified-p))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5945 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5946 org-clock-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5947 ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5948 (lmax 30)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5949 (ltimes (make-vector lmax 0))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5950 (t1 0)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5951 (level 0)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5952 time)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5953 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5954 (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5955 (goto-char (point-max))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5956 (while (re-search-backward re nil t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5957 (if (match-end 2)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5958 ;; A time
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5959 (setq t1 (+ t1 (* 60 (string-to-number (match-string 2)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5960 (string-to-number (match-string 3))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5961 ;; A headline
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5962 (setq level (- (match-end 1) (match-beginning 1)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5963 (when (or (> t1 0) (> (aref ltimes level) 0))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5964 (loop for l from 0 to level do
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5965 (aset ltimes l (+ (aref ltimes l) t1)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5966 (setq t1 0 time (aref ltimes level))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5967 (loop for l from level to (1- lmax) do
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5968 (aset ltimes l 0))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5969 (goto-char (match-beginning 0))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5970 (put-text-property (point) (point-at-eol) :org-clock-minutes time))))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5971 (setq org-clock-file-total-minutes (aref ltimes 0)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
5972 (set-buffer-modified-p bmp)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5973
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5974 (defun org-clock-display (&optional total-only)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5975 "Show subtree times in the entire buffer.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5976 If TOTAL-ONLY is non-nil, only show the total time for the entire file
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5977 in the echo area."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5978 (interactive)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5979 (org-remove-clock-overlays)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5980 (let (time h m p)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5981 (org-clock-sum)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5982 (unless total-only
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5983 (save-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5984 (goto-char (point-min))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5985 (while (setq p (next-single-property-change (point) :org-clock-minutes))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5986 (goto-char p)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5987 (when (setq time (get-text-property p :org-clock-minutes))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5988 (org-put-clock-overlay time (funcall outline-level))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5989 (setq h (/ org-clock-file-total-minutes 60)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5990 m (- org-clock-file-total-minutes (* 60 h)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5991 ;; Arrange to remove the overlays upon next change.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5992 (org-add-hook 'before-change-functions 'org-remove-clock-overlays
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5993 nil 'local)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5994 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5995
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5996 (defvar org-clock-overlays nil)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5997 (make-variable-buffer-local 'org-clock-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
5998
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
5999 (defun org-put-clock-overlay (time &optional level)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6000 "Put an overlays on the current line, displaying TIME.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6001 If LEVEL is given, prefix time with a corresponding number of stars.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6002 This creates a new overlay and stores it in `org-clock-overlays', so that it
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6003 will be easy to remove."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6004 (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6005 (l (if level (org-get-legal-level level 0) 0))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6006 (off 0)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6007 ov tx)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6008 (move-to-column c)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6009 (unless (eolp) (skip-chars-backward "^ \t"))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6010 (skip-chars-backward " \t")
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6011 (setq ov (org-make-overlay (1- (point)) (point-at-eol))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6012 tx (concat (buffer-substring (1- (point)) (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6013 (make-string (+ off (max 0 (- c (current-column)))) ?.)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6014 (org-add-props (format "%s %2d:%02d%s"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6015 (make-string l ?*) h m
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6016 (make-string (- 10 l) ?\ ))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6017 '(face secondary-selection))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6018 ""))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6019 (org-overlay-put ov 'display tx)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6020 (push ov org-clock-overlays)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6021
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6022 (defun org-remove-clock-overlays (&optional beg end noremove)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6023 "Remove the occur highlights from the buffer.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6024 BEG and END are ignored. If NOREMOVE is nil, remove this function
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6025 from the `before-change-functions' in the current buffer."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6026 (interactive)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6027 (unless org-inhibit-highlight-removal
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6028 (mapc 'org-delete-overlay org-clock-overlays)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6029 (setq org-clock-overlays nil)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6030 (unless noremove
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6031 (remove-hook 'before-change-functions
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6032 'org-remove-clock-overlays 'local))))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6033
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6034 (defun org-clock-out-if-current ()
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6035 "Clock out if the current entry contains the running clock.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6036 This is used to stop the clock after a TODO entry is marked DONE."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6037 (when (and (equal state org-done-string)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6038 (equal (marker-buffer org-clock-marker) (current-buffer))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6039 (< (point) org-clock-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6040 (> (save-excursion (outline-next-heading) (point))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6041 org-clock-marker))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6042 (org-clock-out)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6043
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6044 (add-hook 'org-after-todo-state-change-hook
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6045 'org-clock-out-if-current)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6046
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6047 (defun org-check-running-clock ()
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6048 "Check if the current buffer contains the running clock.
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6049 If yes, offer to stop it and to save the buffer with the changes."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6050 (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6051 (y-or-n-p (format "Clock-out in buffer %s before killing it? "
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6052 (buffer-name))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6053 (org-clock-out)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6054 (when (y-or-n-p "Save changed buffer?")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6055 (save-buffer))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6056
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6057 (defun org-clock-report ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6058 "Create a table containing a report about clocked time.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6059 If the buffer contains lines
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6060 #+BEGIN: clocktable :maxlevel 3 :emphasize nil
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6061
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6062 #+END: clocktable
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6063 then the table will be inserted between these lines, replacing whatever
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6064 is was there before. If these lines are not in the buffer, the table
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6065 is inserted at point, surrounded by the special lines.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6066 The BEGIN line can contain parameters. Allowed are:
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6067 :maxlevel The maximum level to be included in the table. Default is 3.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6068 :emphasize t/nil, if levell 1 and level 2 should be bold/italic in the table."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6069 (interactive)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6070 (org-remove-clock-overlays)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6071 (unless (org-find-dblock "clocktable")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6072 (org-create-dblock (list :name "clocktable"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6073 :maxlevel 2 :emphasize nil)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6074 (org-update-dblock))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6075
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6076 (defun org-dblock-write:clocktable (params)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6077 "Write the standard clocktable."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6078 (let ((hlchars '((1 . "*") (2 . ?/)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6079 (emph nil)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6080 (ins (make-marker))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
6081 ipos time h m p level hlc hdl maxlevel)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6082 (setq maxlevel (or (plist-get params :maxlevel) 3)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6083 emph (plist-get params :emphasize))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6084 (move-marker ins (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6085 (setq ipos (point))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6086 (insert-before-markers "Clock summary at ["
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6087 (substring
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6088 (format-time-string (cdr org-time-stamp-formats))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6089 1 -1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6090 "]\n|L|Headline|Time|\n")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6091 (org-clock-sum)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6092 (setq h (/ org-clock-file-total-minutes 60)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6093 m (- org-clock-file-total-minutes (* 60 h)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6094 (insert-before-markers "|-\n|0|" "*Total file time*| "
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6095 (format "*%d:%02d*" h m)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6096 "|\n")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6097 (goto-char (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6098 (while (setq p (next-single-property-change (point) :org-clock-minutes))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6099 (goto-char p)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6100 (when (setq time (get-text-property p :org-clock-minutes))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6101 (beginning-of-line 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6102 (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6103 (setq level (- (match-end 1) (match-beginning 1)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6104 (<= level maxlevel))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6105 (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6106 hdl (match-string 2)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6107 h (/ time 60)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6108 m (- time (* 60 h)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6109 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6110 (goto-char ins)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6111 (if (= level 1) (insert-before-markers "|-\n"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6112 (insert-before-markers
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6113 "| " (int-to-string level) "|" hlc hdl hlc " |"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6114 (make-string (1- level) ?|)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6115 hlc
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6116 (format "%d:%02d" h m)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6117 hlc
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6118 " |\n")))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6119 (goto-char ins)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6120 (backward-delete-char 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6121 (goto-char ipos)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6122 (skip-chars-forward "^|")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6123 (org-table-align)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6124
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6125 (defun org-collect-clock-time-entries ()
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6126 "Return an internal list with clocking information.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6127 This list has one entry for each CLOCK interval.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6128 FIXME: describe the elements."
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6129 (interactive)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6130 (let ((re (concat "^[ \t]*" org-clock-string
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6131 " *\\[\\(.*?\\)\\]--\\[\\(.*?\\)\\]"))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6132 rtn beg end next cont level title total closedp leafp
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6133 clockpos titlepos h m donep)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6134 (save-excursion
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6135 (org-clock-sum)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6136 (goto-char (point-min))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6137 (while (re-search-forward re nil t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6138 (setq clockpos (match-beginning 0)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6139 beg (match-string 1) end (match-string 2)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6140 cont (match-end 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6141 (setq beg (apply 'encode-time (org-parse-time-string beg))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6142 end (apply 'encode-time (org-parse-time-string end)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6143 (org-back-to-heading t)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6144 (setq donep (org-entry-is-done-p))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6145 (setq titlepos (point)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6146 total (or (get-text-property (1+ (point)) :org-clock-minutes) 0)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6147 h (/ total 60) m (- total (* 60 h))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6148 total (cons h m))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6149 (looking-at "\\(\\*+\\) +\\(.*\\)")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6150 (setq level (- (match-end 1) (match-beginning 1))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6151 title (org-match-string-no-properties 2))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6152 (save-excursion (outline-next-heading) (setq next (point)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6153 (setq closedp (re-search-forward org-closed-time-regexp next t))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6154 (goto-char next)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6155 (setq leafp (and (looking-at "^\\*+ ")
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6156 (<= (- (match-end 0) (point)) level)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6157 (push (list beg end clockpos closedp donep
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6158 total title titlepos level leafp)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6159 rtn)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6160 (goto-char cont)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6161 (nreverse rtn)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
6162
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6163 ;;; Agenda, and Diary Integration
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6164
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6165 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6166
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6167 (defvar org-agenda-mode-map (make-sparse-keymap)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6168 "Keymap for `org-agenda-mode'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6169
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6170 (defvar org-agenda-menu) ; defined later in this file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6171 (defvar org-agenda-follow-mode nil)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6172 (defvar org-agenda-show-log nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6173 (defvar org-agenda-buffer-name "*Org Agenda*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6174 (defvar org-agenda-redo-command nil)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6175 (defvar org-agenda-mode-hook nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6176 (defvar org-agenda-type nil)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6177 (defvar org-agenda-force-single-file nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6178
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6179 (defun org-agenda-mode ()
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
6180 "Mode for time-sorted view on action items in Org-mode files.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
6181
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
6182 The following commands are available:
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
6183
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
6184 \\{org-agenda-mode-map}"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6185 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6186 (kill-all-local-variables)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6187 (setq major-mode 'org-agenda-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6188 (setq mode-name "Org-Agenda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6189 (use-local-map org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6190 (easy-menu-add org-agenda-menu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6191 (if org-startup-truncated (setq truncate-lines t))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6192 (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6193 (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6194 (unless org-agenda-keep-modes
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6195 (setq org-agenda-follow-mode org-agenda-start-with-follow-mode
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6196 org-agenda-show-log nil))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6197 (easy-menu-change
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6198 '("Agenda") "Agenda Files"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6199 (append
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6200 (list
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6201 (vector
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6202 (if (get 'org-agenda-files 'org-restrict)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6203 "Restricted to single file"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6204 "Edit File List")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6205 '(org-edit-agenda-file-list)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6206 (not (get 'org-agenda-files 'org-restrict)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6207 "--")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6208 (mapcar 'org-file-menu-entry (org-agenda-files))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6209 (org-agenda-set-mode-name)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6210 (apply
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6211 (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
6212 (list 'org-agenda-mode-hook)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6213
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6214 (define-key org-agenda-mode-map "\C-i" 'org-agenda-goto)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
6215 (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6216 (define-key org-agenda-mode-map "\C-m" 'org-agenda-switch-to)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6217 (define-key org-agenda-mode-map " " 'org-agenda-show)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6218 (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6219 (define-key org-agenda-mode-map "o" 'delete-other-windows)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6220 (define-key org-agenda-mode-map "L" 'org-agenda-recenter)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6221 (define-key org-agenda-mode-map "t" 'org-agenda-todo)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
6222 (define-key org-agenda-mode-map "a" 'org-agenda-toggle-archive-tag)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6223 (define-key org-agenda-mode-map ":" 'org-agenda-set-tags)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6224 (define-key org-agenda-mode-map "." 'org-agenda-goto-today)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6225 (define-key org-agenda-mode-map "d" 'org-agenda-day-view)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6226 (define-key org-agenda-mode-map "w" 'org-agenda-week-view)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6227 (define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6228 (define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
6229 (define-key org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
6230 (define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6231
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6232 (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6233 (define-key org-agenda-mode-map "\C-c\C-s" 'org-agenda-schedule)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6234 (define-key org-agenda-mode-map "\C-c\C-d" 'org-agenda-deadline)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6235 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6236 (while l (define-key org-agenda-mode-map
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6237 (int-to-string (pop l)) 'digit-argument)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6238
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6239 (define-key org-agenda-mode-map "f" 'org-agenda-follow-mode)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6240 (define-key org-agenda-mode-map "l" 'org-agenda-log-mode)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6241 (define-key org-agenda-mode-map "D" 'org-agenda-toggle-diary)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6242 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6243 (define-key org-agenda-mode-map "r" 'org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6244 (define-key org-agenda-mode-map "q" 'org-agenda-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6245 (define-key org-agenda-mode-map "x" 'org-agenda-exit)
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6246 (define-key org-agenda-mode-map "s" 'org-save-all-org-buffers)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6247 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6248 (define-key org-agenda-mode-map "T" 'org-agenda-show-tags)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6249 (define-key org-agenda-mode-map "n" 'next-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6250 (define-key org-agenda-mode-map "p" 'previous-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6251 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6252 (define-key org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6253 (define-key org-agenda-mode-map "," 'org-agenda-priority)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6254 (define-key org-agenda-mode-map "\C-c," 'org-agenda-priority)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6255 (define-key org-agenda-mode-map "i" 'org-agenda-diary-entry)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6256 (define-key org-agenda-mode-map "c" 'org-agenda-goto-calendar)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6257 (eval-after-load "calendar"
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6258 '(define-key calendar-mode-map org-calendar-to-agenda-key
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6259 'org-calendar-goto-agenda))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6260 (define-key org-agenda-mode-map "C" 'org-agenda-convert-date)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6261 (define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6262 (define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6263 (define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6264 (define-key org-agenda-mode-map "h" 'org-agenda-holidays)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6265 (define-key org-agenda-mode-map "H" 'org-agenda-holidays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6266 (define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6267 (define-key org-agenda-mode-map "I" 'org-agenda-clock-in)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6268 (define-key org-agenda-mode-map "O" 'org-clock-out)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
6269 (define-key org-agenda-mode-map "X" 'org-clock-cancel)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6270 (define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6271 (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6272 (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
6273 (define-key org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
6274 (define-key org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6275 (define-key org-agenda-mode-map [(right)] 'org-agenda-later)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6276 (define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
6277 (define-key org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6278 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6279 "Local keymap for agenda entries from Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6280
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6281 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6282 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6283 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6284 (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
6285 (when org-agenda-mouse-1-follows-link
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
6286 (define-key org-agenda-keymap [follow-link] 'mouse-face))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6287 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6288 '("Agenda"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6289 ("Agenda Files")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6290 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6291 ["Show" org-agenda-show t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6292 ["Go To (other window)" org-agenda-goto t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6293 ["Go To (one window)" org-agenda-switch-to t]
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6294 ["Follow Mode" org-agenda-follow-mode
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6295 :style toggle :selected org-agenda-follow-mode :active t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6296 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6297 ["Cycle TODO" org-agenda-todo t]
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6298 ("Tags"
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6299 ["Show all Tags" org-agenda-show-tags t]
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6300 ["Set Tags" org-agenda-set-tags t])
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6301 ("Schedule"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6302 ["Schedule" org-agenda-schedule t]
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6303 ["Set Deadline" org-agenda-deadline t]
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6304 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6305 ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6306 ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6307 ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6308 ("Priority"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6309 ["Set Priority" org-agenda-priority t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6310 ["Increase Priority" org-agenda-priority-up t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6311 ["Decrease Priority" org-agenda-priority-down t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6312 ["Show Priority" org-agenda-show-priority t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6313 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6314 ;; ["New agenda command" org-agenda t]
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6315 ["Rebuild buffer" org-agenda-redo t]
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6316 ["Save all Org-mode Buffers" org-save-all-org-buffers t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6317 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6318 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6319 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6320 ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6321 "--"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6322 ["Day View" org-agenda-day-view :active (org-agenda-check-type nil 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6323 :style radio :selected (equal org-agenda-ndays 1)]
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6324 ["Week View" org-agenda-week-view :active (org-agenda-check-type nil 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6325 :style radio :selected (equal org-agenda-ndays 7)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6326 "--"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6327 ["Show Logbook entries" org-agenda-log-mode
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6328 :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6329 ["Include Diary" org-agenda-toggle-diary
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6330 :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)]
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6331 ["Use Time Grid" org-agenda-toggle-time-grid
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6332 :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6333 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6334 ["New Diary Entry" org-agenda-diary-entry (org-agenda-check-type nil 'agenda 'timeline)]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6335 ("Calendar Commands"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6336 ["Goto Calendar" org-agenda-goto-calendar (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6337 ["Phases of the Moon" org-agenda-phases-of-moon (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6338 ["Sunrise/Sunset" org-agenda-sunrise-sunset (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6339 ["Holidays" org-agenda-holidays (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6340 ["Convert" org-agenda-convert-date (org-agenda-check-type nil 'agenda 'timeline)])
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
6341 ["Create iCalendar file" org-export-icalendar-combine-agenda-files t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6342 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6343 ["Quit" org-agenda-quit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6344 ["Exit and Release Buffers" org-agenda-exit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6345 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6346
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6347 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6348 (defun org-agenda (arg)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6349 "Dispatch agenda commands to collect entries to the agenda buffer.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6350 Prompts for a character to select a command. Any prefix arg will be passed
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6351 on to the selected command. The default selections are:
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6352
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6353 a Call `org-agenda' to display the agenda for the current day or week.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6354 t Call `org-todo-list' to display the global todo list.
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6355 T Call `org-todo-list' to display the global todo list, select only
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6356 entries with a specific TODO keyword (the user gets a prompt).
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6357 m Call `org-tags-view' to display headlines with tags matching
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6358 a condition (the user is prompted for the condition).
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6359 M Like `m', but select only TODO entries, no ordinary headlines.
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6360
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6361 More commands can be added by configuring the variable
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6362 `org-agenda-custom-commands'. In particular, specific tags and TODO keyword
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6363 searches can be pre-defined in this way.
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6364
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6365 If the current buffer is in Org-mode and visiting a file, you can also
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6366 first press `1' to indicate that the agenda should be temporarily (until the
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6367 next use of \\[org-agenda]) restricted to the current file."
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6368 (interactive "P")
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6369 (catch 'exit
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6370 (let ((restrict-ok (and buffer-file-name (org-mode-p)))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
6371 (bfn buffer-file-name)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6372 (custom org-agenda-custom-commands)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6373 c entry key type string)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6374 (put 'org-agenda-files 'org-restrict nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6375 (save-window-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6376 (delete-other-windows)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6377 (switch-to-buffer-other-window " *Agenda Commands*")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6378 (erase-buffer)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6379 (insert
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6380 "Press key for an agenda command:
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6381 --------------------------------
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6382 a Agenda for current week or day
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6383 t List of all TODO entries T Entries with special TODO kwd
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6384 m Match a TAGS query M Like m, but only TODO entries
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6385 C Configure your own agenda commands")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6386 (while (setq entry (pop custom))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6387 (setq key (car entry) type (nth 1 entry) string (nth 2 entry))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6388 (insert (format "\n%-4s%-14s: %s"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6389 key
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6390 (cond
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6391 ((eq type 'tags) "Tags query")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6392 ((eq type 'todo) "TODO keyword")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6393 ((eq type 'tags-tree) "Tags tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6394 ((eq type 'todo-tree) "TODO kwd tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6395 ((eq type 'occur-tree) "Occur tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6396 (t "???"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6397 (org-add-props string nil 'face 'org-warning))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6398 (goto-char (point-min))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6399 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6400 (message "Press key for agenda command%s"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6401 (if restrict-ok ", or [1] to restrict to current file" ""))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6402 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6403 (message "")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6404 (when (equal c ?1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6405 (if restrict-ok
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
6406 (put 'org-agenda-files 'org-restrict (list bfn))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6407 (error "Cannot restrict agenda to current buffer"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6408 (message "Press key for agenda command%s"
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6409 (if restrict-ok " (restricted to current file)" ""))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6410 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6411 (message "")))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6412 (require 'calendar) ; FIXME: can we avoid this for some commands?
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6413 ;; For example the todo list should not need it (but does...)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6414 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6415 ((equal c ?C) (customize-variable 'org-agenda-custom-commands))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6416 ((equal c ?a) (call-interactively 'org-agenda-list))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6417 ((equal c ?t) (call-interactively 'org-todo-list))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6418 ((equal c ?T) (org-call-with-arg 'org-todo-list (or arg '(4))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6419 ((equal c ?m) (call-interactively 'org-tags-view))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6420 ((equal c ?M) (org-call-with-arg 'org-tags-view (or arg '(4))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6421 ((setq entry (assoc (char-to-string c) org-agenda-custom-commands))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6422 (setq type (nth 1 entry) string (nth 2 entry))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6423 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6424 ((eq type 'tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6425 (org-tags-view current-prefix-arg string))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6426 ((eq type 'tags-todo)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6427 (org-tags-view '(4) string))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6428 ((eq type 'todo)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6429 (org-todo-list string))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6430 ((eq type 'tags-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6431 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6432 (org-tags-sparse-tree current-prefix-arg string))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6433 ((eq type 'todo-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6434 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6435 (org-occur (concat "^" outline-regexp "[ \t]*"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6436 (regexp-quote string) "\\>")))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6437 ((eq type 'occur-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6438 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6439 (org-occur string))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6440 (t (error "Invalid custom agenda command type %s" type))))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6441 (t (error "Invalid key"))))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6442
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6443 (defun org-check-for-org-mode ()
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6444 "Make sure current buffer is in org-mode. Error if not."
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6445 (or (org-mode-p)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6446 (error "Cannot execute org-mode agenda command on buffer in %s."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6447 major-mode)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6448
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6449 (defun org-fit-agenda-window ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6450 "Fit the window to the buffer size."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6451 (and org-fit-agenda-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6452 (fboundp 'fit-window-to-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6453 (fit-window-to-buffer nil (/ (* (frame-height) 3) 4)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6454 (/ (frame-height) 2))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6455
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6456 (defun org-agenda-files (&optional unrestricted)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6457 "Get the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6458 Optional UNRESTRICTED means return the full list even if a restriction
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6459 is currently in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6460 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6461 ((and (not unrestricted) (get 'org-agenda-files 'org-restrict)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6462 ((stringp org-agenda-files) (org-read-agenda-file-list))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6463 ((listp org-agenda-files) org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6464 (t (error "Invalid value of `org-agenda-files'"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6465
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6466 (defvar org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6467
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6468 (defun org-edit-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6469 "Edit the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6470 Depending on setup, this either uses customize to edit the variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6471 `org-agenda-files', or it visits the file that is holding the list. In the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6472 latter case, the buffer is set up in a way that saving it automatically kills
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6473 the buffer and restores the previous window configuration."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6474 (interactive)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6475 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6476 (let ((cw (current-window-configuration)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6477 (find-file org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6478 (set (make-local-variable 'org-window-configuration) cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6479 (org-add-hook 'after-save-hook
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6480 (lambda ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6481 (set-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6482 (prog1 org-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6483 (kill-buffer (current-buffer))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6484 (org-install-agenda-files-menu)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6485 (message "New agenda file list installed"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6486 nil 'local)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6487 (message (substitute-command-keys
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6488 "Edit list and finish with \\[save-buffer]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6489 (customize-variable 'org-agenda-files)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6490
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6491 (defun org-store-new-agenda-file-list (list)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6492 "Set new value for the agenda file list and save it correcly."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6493 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6494 (let ((f org-agenda-files) b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6495 (while (setq b (find-buffer-visiting f)) (kill-buffer b))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6496 (with-temp-file f
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6497 (insert (mapconcat 'identity list "\n") "\n")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6498 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6499 (setq org-agenda-files list)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6500 (customize-save-variable 'org-agenda-files org-agenda-files))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6501
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6502 (defun org-read-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6503 "Read the list of agenda files from a file."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6504 (when (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6505 (with-temp-buffer
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6506 (insert-file-contents org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6507 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6508
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6509 (defvar org-agenda-markers nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6510 "List of all currently active markers created by `org-agenda'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6511 (defvar org-agenda-last-marker-time (time-to-seconds (current-time))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6512 "Creation time of the last agenda marker.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6513
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6514 (defun org-agenda-new-marker (&optional pos)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6515 "Return a new agenda marker.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6516 Org-mode keeps a list of these markers and resets them when they are
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6517 no longer in use."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6518 (let ((m (copy-marker (or pos (point)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6519 (setq org-agenda-last-marker-time (time-to-seconds (current-time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6520 (push m org-agenda-markers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6521 m))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6522
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6523 (defun org-agenda-maybe-reset-markers (&optional force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6524 "Reset markers created by `org-agenda'. But only if they are old enough."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6525 (if (or force
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6526 (> (- (time-to-seconds (current-time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6527 org-agenda-last-marker-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6528 5))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6529 (while org-agenda-markers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6530 (move-marker (pop org-agenda-markers) nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6531
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6532 (defvar org-agenda-new-buffers nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6533 "Buffers created to visit agenda files.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6534
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6535 (defun org-get-agenda-file-buffer (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6536 "Get a buffer visiting FILE. If the buffer needs to be created, add
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6537 it to the list of buffers which might be released later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6538 (let ((buf (find-buffer-visiting file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6539 (if buf
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6540 buf ; just return it
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6541 ;; Make a new buffer and remember it
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6542 (setq buf (find-file-noselect file))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6543 (if buf (push buf org-agenda-new-buffers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6544 buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6545
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6546 (defun org-release-buffers (blist)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6547 "Release all buffers in list, asking the user for confirmation when needed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6548 When a buffer is unmodified, it is just killed. When modified, it is saved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6549 \(if the user agrees) and then killed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6550 (let (buf file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6551 (while (setq buf (pop blist))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6552 (setq file (buffer-file-name buf))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6553 (when (and (buffer-modified-p buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6554 file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6555 (y-or-n-p (format "Save file %s? " file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6556 (with-current-buffer buf (save-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6557 (kill-buffer buf))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6558
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6559 (defvar org-respect-restriction nil) ; Dynamically-scoped param.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6560
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6561 (defun org-timeline (&optional include-all keep-modes)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6562 "Show a time-sorted view of the entries in the current org file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6563 Only entries with a time stamp of today or later will be listed. With
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6564 \\[universal-argument] prefix, all unfinished TODO items will also be shown,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6565 under the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6566 If the buffer contains an active region, only check the region for
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6567 dates."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6568 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6569 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6570 (org-agenda-maybe-reset-markers 'force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6571 (org-compile-prefix-format org-timeline-prefix-format)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6572 (let* ((dopast t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6573 (dotodo include-all)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6574 (doclosed org-agenda-show-log)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6575 (org-agenda-keep-modes keep-modes)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6576 (entry buffer-file-name)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6577 (org-agenda-files (list buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6578 (date (calendar-current-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6579 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6580 (pos1 (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6581 (beg (if (org-region-active-p) (region-beginning) (point-min)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6582 (end (if (org-region-active-p) (region-end) (point-max)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6583 (day-numbers (org-get-all-dates beg end 'no-ranges
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6584 t doclosed ; always include today
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6585 org-timeline-show-empty-dates))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6586 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6587 (org-respect-restriction t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6588 (past t)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6589 args
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6590 s e rtn d emptyp)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
6591 (org-prepare-agenda-buffers org-agenda-files)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6592 (setq org-agenda-redo-command
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6593 (list 'progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6594 (list 'switch-to-buffer-other-window (current-buffer))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6595 (list 'org-timeline (list 'quote include-all) t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6596 (if (not dopast)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6597 ;; Remove past dates from the list of dates.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6598 (setq day-numbers (delq nil (mapcar (lambda(x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6599 (if (>= x today) x nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6600 day-numbers))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6601 (switch-to-buffer-other-window
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6602 (get-buffer-create org-agenda-buffer-name))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6603 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6604 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6605 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6606 (set (make-local-variable 'org-agenda-type) 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6607 (if doclosed (push :closed args))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6608 (push :timestamp args)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6609 (if dotodo (push :todo args))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6610 (while (setq d (pop day-numbers))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6611 (if (and (listp d) (eq (car d) :omitted))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6612 (progn
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6613 (setq s (point))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6614 (insert (format "\n[... %d empty days omitted]\n\n" (cdr d)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6615 (put-text-property s (1- (point)) 'face 'org-level-3))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6616 (if (listp d) (setq d (car d) emptyp t) (setq emptyp nil))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6617 (if (and (>= d today)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6618 dopast
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6619 past)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6620 (progn
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6621 (setq past nil)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6622 (insert (make-string 79 ?-) "\n")))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6623 (setq date (calendar-gregorian-from-absolute d))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6624 (setq s (point))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6625 (setq rtn (and (not emptyp)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6626 (apply 'org-agenda-get-day-entries
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6627 entry date args)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6628 (if (or rtn (equal d today) org-timeline-show-empty-dates)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6629 (progn
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6630 (insert (calendar-day-name date) " "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6631 (number-to-string (extract-calendar-day date)) " "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6632 (calendar-month-name (extract-calendar-month date)) " "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6633 (number-to-string (extract-calendar-year date)) "\n")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6634 (put-text-property s (1- (point)) 'face
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6635 'org-level-3)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6636 (if (equal d today)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6637 (put-text-property s (1- (point)) 'org-today t))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6638 (and rtn (insert (org-finalize-agenda-entries rtn) "\n"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
6639 (put-text-property s (1- (point)) 'day d)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6640 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6641 (setq buffer-read-only t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6642 (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6643 (point-min)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6644 (when (not org-select-timeline-window)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6645 (select-window win)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6646 (goto-char pos1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6647
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6648 ;;;###autoload
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6649 (defun org-agenda-list (&optional include-all start-day ndays keep-modes)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6650 "Produce a weekly view from all files in variable `org-agenda-files'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6651 The view will be for the current week, but from the overview buffer you
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6652 will be able to go to other weeks.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6653 With one \\[universal-argument] prefix argument INCLUDE-ALL, all unfinished TODO items will
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6654 also be shown, under the current date.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6655 With two \\[universal-argument] prefix argument INCLUDE-ALL, all TODO entries marked DONE
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6656 on the days are also shown. See the variable `org-log-done' for how
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6657 to turn on logging.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6658 START-DAY defaults to TODAY, or to the most recent match for the weekday
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6659 given in `org-agenda-start-on-weekday'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6660 NDAYS defaults to `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6661 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6662 (org-agenda-maybe-reset-markers 'force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6663 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6664 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6665 (let* ((org-agenda-start-on-weekday
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6666 (if (or (equal ndays 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6667 (and (null ndays) (equal 1 org-agenda-ndays)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6668 nil org-agenda-start-on-weekday))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6669 (org-agenda-keep-modes keep-modes)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6670 (thefiles (org-agenda-files))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6671 (files thefiles)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6672 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6673 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6674 (sd (or start-day today))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6675 (start (if (or (null org-agenda-start-on-weekday)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6676 (< org-agenda-ndays 7))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6677 sd
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6678 (let* ((nt (calendar-day-of-week
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6679 (calendar-gregorian-from-absolute sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6680 (n1 org-agenda-start-on-weekday)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6681 (d (- nt n1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6682 (- sd (+ (if (< d 0) 7 0) d)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6683 (day-numbers (list start))
70019
a186cf26482b *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70018
diff changeset
6684 (inhibit-redisplay t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6685 s e rtn rtnall file date d start-pos end-pos todayp nd)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
6686 (org-prepare-agenda-buffers files)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6687 (setq org-agenda-redo-command
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6688 (list 'org-agenda-list (list 'quote include-all) start-day ndays t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6689 ;; Make the list of days
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6690 (setq ndays (or ndays org-agenda-ndays)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6691 nd ndays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6692 (while (> ndays 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6693 (push (1+ (car day-numbers)) day-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6694 (setq ndays (1- ndays)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6695 (setq day-numbers (nreverse day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6696 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6697 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6698 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6699 (switch-to-buffer-other-window
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6700 (get-buffer-create org-agenda-buffer-name))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6701 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6702 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6703 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6704 (set (make-local-variable 'org-agenda-type) 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6705 (set (make-local-variable 'starting-day) (car day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6706 (set (make-local-variable 'include-all-loc) include-all)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6707 (when (and (or include-all org-agenda-include-all-todo)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6708 (member today day-numbers))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6709 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6710 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6711 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6712 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6713 (org-check-agenda-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6714 (setq date (calendar-gregorian-from-absolute today)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6715 rtn (org-agenda-get-day-entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6716 file date :todo))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6717 (setq rtnall (append rtnall rtn))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6718 (when rtnall
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6719 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6720 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6721 (list 'face 'org-level-3))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6722 (insert (org-finalize-agenda-entries rtnall) "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6723 (while (setq d (pop day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6724 (setq date (calendar-gregorian-from-absolute d)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6725 s (point))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6726 (if (or (setq todayp (= d today))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6727 (and (not start-pos) (= d sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6728 (setq start-pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6729 (if (and start-pos (not end-pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6730 (setq end-pos (point))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6731 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6732 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6733 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6734 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6735 (org-check-agenda-file file)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6736 (if org-agenda-show-log
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6737 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6738 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6739 :deadline :scheduled :timestamp :closed))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6740 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6741 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6742 :deadline :scheduled :timestamp)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6743 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6744 (if org-agenda-include-diary
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6745 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6746 (require 'diary-lib)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6747 (setq rtn (org-get-entries-from-diary date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6748 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6749 (if (or rtnall org-agenda-show-all-dates)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6750 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6751 (insert (format "%-9s %2d %s %4d\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6752 (calendar-day-name date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6753 (extract-calendar-day date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6754 (calendar-month-name (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6755 (extract-calendar-year date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6756 (put-text-property s (1- (point)) 'face
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6757 'org-level-3)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6758 (if rtnall (insert
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6759 (org-finalize-agenda-entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6760 (org-agenda-add-time-grid-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6761 rtnall nd todayp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6762 "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6763 (put-text-property s (1- (point)) 'day d))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6764 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6765 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6766 (org-fit-agenda-window)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6767 (unless (and (pos-visible-in-window-p (point-min))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6768 (pos-visible-in-window-p (point-max)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6769 (goto-char (1- (point-max)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6770 (recenter -1)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6771 (if (not (pos-visible-in-window-p (or start-pos 1)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6772 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6773 (goto-char (or start-pos 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6774 (recenter 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6775 (goto-char (or start-pos 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6776 (if (not org-select-agenda-window) (select-window win))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6777 (message "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6778
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6779 (defvar org-select-this-todo-keyword nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6780
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6781 ;;;###autoload
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6782 (defun org-todo-list (arg &optional keep-modes)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6783 "Show all TODO entries from all agenda file in a single list.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6784 The prefix arg can be used to select a specific TODO keyword and limit
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6785 the list to these. When using \\[universal-argument], you will be prompted
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6786 for a keyword. A numeric prefix directly selects the Nth keyword in
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6787 `org-todo-keywords'."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6788 (interactive "P")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6789 (org-agenda-maybe-reset-markers 'force)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6790 (org-compile-prefix-format org-agenda-prefix-format)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6791 (let* ((org-agenda-keep-modes keep-modes)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6792 (today (time-to-days (current-time)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6793 (date (calendar-gregorian-from-absolute today))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6794 (win (selected-window))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6795 (kwds org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6796 (completion-ignore-case t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6797 (org-select-this-todo-keyword
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6798 (if (stringp arg) arg
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6799 (and arg (integerp arg) (> arg 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6800 (nth (1- arg) org-todo-keywords))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6801 rtn rtnall files file pos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6802 (when (equal arg '(4))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6803 (setq org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6804 (completing-read "Keyword: " (mapcar 'list org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6805 nil t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6806 (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6807 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6808 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6809 (delete-other-windows)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6810 (switch-to-buffer-other-window
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6811 (get-buffer-create org-agenda-buffer-name))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6812 (setq buffer-read-only nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6813 (erase-buffer)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6814 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6815 (set (make-local-variable 'org-agenda-type) 'todo)
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6816 (set (make-local-variable 'last-arg) arg)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6817 (set (make-local-variable 'org-todo-keywords) kwds)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6818 (set (make-local-variable 'org-agenda-redo-command)
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6819 '(org-todo-list (or current-prefix-arg last-arg) t))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6820 (setq files (org-agenda-files)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6821 rtnall nil)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
6822 (org-prepare-agenda-buffers files)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6823 (while (setq file (pop files))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6824 (catch 'nextfile
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6825 (org-check-agenda-file file)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6826 (setq rtn (org-agenda-get-day-entries file date :todo))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6827 (setq rtnall (append rtnall rtn))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6828 (insert "Global list of TODO items of type: ")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6829 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6830 (list 'face 'org-level-3))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6831 (setq pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6832 (insert (or org-select-this-todo-keyword "ALL") "\n")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6833 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6834 (setq pos (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6835 (insert
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6836 "Available with `N r': (0)ALL "
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6837 (let ((n 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6838 (mapconcat (lambda (x)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6839 (format "(%d)%s" (setq n (1+ n)) x))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6840 org-todo-keywords " "))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6841 "\n")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6842 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6843 (when rtnall
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6844 (insert (org-finalize-agenda-entries rtnall) "\n"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6845 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6846 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6847 (org-fit-agenda-window)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6848 (if (not org-select-agenda-window) (select-window win))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6849
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6850 (defun org-check-agenda-file (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6851 "Make sure FILE exists. If not, ask user what to do."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6852 (when (not (file-exists-p file))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6853 (message "non-existent file %s. [R]emove from list or [A]bort?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6854 (abbreviate-file-name file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6855 (let ((r (downcase (read-char-exclusive))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6856 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6857 ((equal r ?r)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6858 (org-remove-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6859 (throw 'nextfile t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6860 (t (error "Abort"))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6861
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6862 (defun org-agenda-check-type (error &rest types)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6863 "Check if agenda buffer is of allowed type.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6864 If ERROR is non-nil, throw an error, otherwise just return nil."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6865 (if (memq org-agenda-type types)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6866 t
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6867 (if error
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
6868 (error "Not allowed in %s-type agenda buffers" org-agenda-type)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6869 nil)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6870
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6871 (defun org-agenda-quit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6872 "Exit agenda by removing the window or the buffer."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6873 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6874 (let ((buf (current-buffer)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6875 (if (not (one-window-p)) (delete-window))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6876 (kill-buffer buf)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6877 (org-agenda-maybe-reset-markers 'force)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6878
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6879 (defun org-agenda-exit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6880 "Exit agenda by removing the window or the buffer.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6881 Also kill all Org-mode buffers which have been loaded by `org-agenda'.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6882 Org-mode buffers visited directly by the user will not be touched."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6883 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6884 (org-release-buffers org-agenda-new-buffers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6885 (setq org-agenda-new-buffers nil)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6886 (org-agenda-quit))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6887
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6888 ;; FIXME: move this function.
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6889 (defun org-save-all-org-buffers ()
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6890 "Save all Org-mode buffers without user confirmation."
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6891 (interactive)
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6892 (message "Saving all Org-mode buffers...")
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6893 (save-some-buffers t 'org-mode-p)
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6894 (message "Saving all Org-mode buffers... done"))
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
6895
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6896 (defun org-agenda-redo ()
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6897 "Rebuild Agenda.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6898 When this is the global TODO list, a prefix argument will be interpreted."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6899 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6900 (message "Rebuilding agenda buffer...")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6901 (eval org-agenda-redo-command)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6902 (message "Rebuilding agenda buffer...done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6903
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6904 (defun org-agenda-goto-today ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6905 "Go to today."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6906 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6907 (org-agenda-check-type t 'timeline 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6908 (if (boundp 'starting-day)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6909 (let ((cmd (car org-agenda-redo-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6910 (iall (nth 1 org-agenda-redo-command))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6911 (nday (nth 3 org-agenda-redo-command))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6912 (keep (nth 4 org-agenda-redo-command)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6913 (eval (list cmd iall nil nday keep)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6914 (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6915 (point-min)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6916
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6917 (defun org-agenda-later (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6918 "Go forward in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6919 With prefix ARG, go forward that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6920 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6921 (org-agenda-check-type t 'agenda)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6922 (org-agenda-list (if (boundp 'include-all-loc) include-all-loc nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6923 (+ starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6924
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6925 (defun org-agenda-earlier (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6926 "Go back in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6927 With prefix ARG, go back that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6928 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6929 (org-agenda-check-type t 'agenda)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6930 (org-agenda-list (if (boundp 'include-all-loc) include-all-loc nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6931 (- starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6932
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6933 (defun org-agenda-week-view ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6934 "Switch to weekly view for agenda."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6935 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6936 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6937 (setq org-agenda-ndays 7)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6938 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6939 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6940 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6941 nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6942 (org-agenda-set-mode-name)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6943 (message "Switched to week view"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6944
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6945 (defun org-agenda-day-view ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6946 "Switch to daily view for agenda."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6947 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6948 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6949 (setq org-agenda-ndays 1)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6950 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6951 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6952 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6953 nil t)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6954 (org-agenda-set-mode-name)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
6955 (message "Switched to day view"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6956
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6957 (defun org-agenda-next-date-line (&optional arg)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6958 "Jump to the next line indicating a date in agenda buffer."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6959 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6960 (org-agenda-check-type t 'agenda 'timeline)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6961 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6962 (if (looking-at "^\\S-") (forward-char 1))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6963 (if (not (re-search-forward "^\\S-" nil t arg))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6964 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6965 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6966 (error "No next date after this line in this buffer")))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6967 (goto-char (match-beginning 0)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6968
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6969 (defun org-agenda-previous-date-line (&optional arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6970 "Jump to the previous line indicating a date in agenda buffer."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6971 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6972 (org-agenda-check-type t 'agenda 'timeline)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6973 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6974 (if (not (re-search-backward "^\\S-" nil t arg))
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
6975 (error "No previous date before this line in this buffer")))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6976
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6977 ;; Initialize the highlight
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6978 (defvar org-hl (org-make-overlay 1 1))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6979 (org-overlay-put org-hl 'face 'highlight)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6980
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6981 (defun org-highlight (begin end &optional buffer)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6982 "Highlight a region with overlay."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6983 (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6984 org-hl begin end (or buffer (current-buffer))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6985
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6986 (defun org-unhighlight ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6987 "Detach overlay INDEX."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6988 (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6989
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6990
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6991 (defun org-agenda-follow-mode ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6992 "Toggle follow mode in an agenda buffer."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6993 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6994 (setq org-agenda-follow-mode (not org-agenda-follow-mode))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6995 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6996 (message "Follow mode is %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6997 (if org-agenda-follow-mode "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6998
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6999 (defun org-agenda-log-mode ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7000 "Toggle log mode in an agenda buffer."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7001 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7002 (org-agenda-check-type t 'agenda 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7003 (setq org-agenda-show-log (not org-agenda-show-log))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7004 (org-agenda-set-mode-name)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7005 (org-agenda-redo)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7006 (message "Log mode is %s"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7007 (if org-agenda-show-log "on" "off")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7008
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7009 (defun org-agenda-toggle-diary ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7010 "Toggle diary inclusion in an agenda buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7011 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7012 (org-agenda-check-type t 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7013 (setq org-agenda-include-diary (not org-agenda-include-diary))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7014 (org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7015 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7016 (message "Diary inclusion turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7017 (if org-agenda-include-diary "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7018
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7019 (defun org-agenda-toggle-time-grid ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7020 "Toggle time grid in an agenda buffer."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7021 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7022 (org-agenda-check-type t 'agenda)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7023 (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7024 (org-agenda-redo)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7025 (org-agenda-set-mode-name)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7026 (message "Time-grid turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7027 (if org-agenda-use-time-grid "on" "off")))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7028
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7029 (defun org-agenda-set-mode-name ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
7030 "Set the mode name to indicate all the small mode settings."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7031 (setq mode-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7032 (concat "Org-Agenda"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7033 (if (equal org-agenda-ndays 1) " Day" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7034 (if (equal org-agenda-ndays 7) " Week" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7035 (if org-agenda-follow-mode " Follow" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7036 (if org-agenda-include-diary " Diary" "")
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7037 (if org-agenda-use-time-grid " Grid" "")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7038 (if org-agenda-show-log " Log" "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7039 (force-mode-line-update))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7040
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7041 (defun org-agenda-post-command-hook ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
7042 (and (eolp) (not (bolp)) (backward-char 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7043 (if (and org-agenda-follow-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7044 (get-text-property (point) 'org-marker))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7045 (org-agenda-show)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7046
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7047 (defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7048
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7049 (defun org-get-entries-from-diary (date)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7050 "Get the (Emacs Calendar) diary entries for DATE."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7051 (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7052 (diary-display-hook '(fancy-diary-display))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7053 (list-diary-entries-hook
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7054 (cons 'org-diary-default-entry list-diary-entries-hook))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7055 (diary-file-name-prefix-function nil) ; turn this feature off
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7056 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7057 entries
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7058 (org-disable-agenda-to-diary t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7059 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7060 (save-window-excursion
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
7061 (list-diary-entries date 1))) ;; Keep this name for now, compatibility
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7062 (if (not (get-buffer fancy-diary-buffer))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7063 (setq entries nil)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7064 (with-current-buffer fancy-diary-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7065 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7066 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7067 ;; No entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7068 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7069 ;; Omit the date and other unnecessary stuff
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7070 (org-agenda-cleanup-fancy-diary)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7071 ;; Add prefix to each line and extend the text properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7072 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7073 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7074 (setq entries (buffer-substring (point-min) (- (point-max) 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7075 (set-buffer-modified-p nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7076 (kill-buffer fancy-diary-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7077 (when entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7078 (setq entries (org-split-string entries "\n"))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7079 (setq entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7080 (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7081 (lambda (x)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7082 (setq x (org-format-agenda-item "" x "Diary" nil 'time))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7083 ;; Extend the text properties to the beginning of the line
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7084 (org-add-props x (text-properties-at (1- (length x)) x)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7085 entries)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7086
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7087 (defun org-agenda-cleanup-fancy-diary ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7088 "Remove unwanted stuff in buffer created by `fancy-diary-display'.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7089 This gets rid of the date, the underline under the date, and
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7090 the dummy entry installed by `org-mode' to ensure non-empty diary for each
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7091 date. It also removes lines that contain only whitespace."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7092 (goto-char (point-min))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7093 (if (looking-at ".*?:[ \t]*")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7094 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7095 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7096 (re-search-forward "\n=+$" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7097 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7098 (while (re-search-backward "^ +\n?" nil t) (replace-match "")))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7099 (re-search-forward "\n=+$" nil t)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7100 (delete-region (point-min) (min (point-max) (1+ (match-end 0)))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7101 (goto-char (point-min))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7102 (while (re-search-forward "^ +\n" nil t)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7103 (replace-match ""))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7104 (goto-char (point-min))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7105 (if (re-search-forward "^Org-mode dummy\n?" nil t)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7106 (replace-match "")))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7107
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7108 ;; Make sure entries from the diary have the right text properties.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7109 (eval-after-load "diary-lib"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7110 '(if (boundp 'diary-modify-entry-list-string-function)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7111 ;; We can rely on the hook, nothing to do
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7112 nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7113 ;; Hook not avaiable, must use advice to make this work
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7114 (defadvice add-to-diary-list (before org-mark-diary-entry activate)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7115 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7116 (if (and org-disable-agenda-to-diary ;; called from org-agenda
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7117 (stringp string)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7118 buffer-file-name)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7119 (setq string (org-modify-diary-entry-string string))))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7120
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7121 (defun org-modify-diary-entry-string (string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7122 "Add text properties to string, allowing org-mode to act on it."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7123 (org-add-props string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7124 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7125 'keymap org-agenda-keymap
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7126 'help-echo (format "mouse-2 or RET jump to diary file %s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7127 (abbreviate-file-name buffer-file-name))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7128 'org-agenda-diary-link t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7129 'org-marker (org-agenda-new-marker (point-at-bol))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7130
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7131 (defun org-diary-default-entry ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7132 "Add a dummy entry to the diary.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7133 Needed to avoid empty dates which mess up holiday display."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
7134 ;; Catch the error if dealing with the new add-to-diary-alist
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7135 (when org-disable-agenda-to-diary
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7136 (condition-case nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7137 (add-to-diary-list original-date "Org-mode dummy" "")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7138 (error
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7139 (add-to-diary-list original-date "Org-mode dummy" "" nil)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
7140
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7141 (defun org-cycle-agenda-files ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7142 "Cycle through the files in `org-agenda-files'.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7143 If the current buffer visits an agenda file, find the next one in the list.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7144 If the current buffer does not, find the first agenda file."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7145 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7146 (let* ((fs (org-agenda-files t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7147 (files (append fs (list (car fs))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7148 (tcf (if buffer-file-name (file-truename buffer-file-name)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7149 file)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7150 (unless files (error "No agenda files"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7151 (catch 'exit
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7152 (while (setq file (pop files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7153 (if (equal (file-truename file) tcf)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7154 (when (car files)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7155 (find-file (car files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7156 (throw 'exit t))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7157 (find-file (car fs)))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7158
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7159 (defun org-agenda-file-to-end ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7160 "Move/add the current file to the end of the agenda file list.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7161 If the file is not present in the list, it is appended to the list. If it is
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7162 present, it is moved there."
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7163 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7164 (org-agenda-file-to-front 'to-end))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7165
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7166 (defun org-agenda-file-to-front (&optional to-end)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7167 "Move/add the current file to the top of the agenda file list.
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7168 If the file is not present in the list, it is added to the front. If it is
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7169 present, it is moved there. With optional argument TO-END, add/move to the
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7170 end of the list."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7171 (interactive "P")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7172 (let ((file-alist (mapcar (lambda (x)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7173 (cons (file-truename x) x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7174 (org-agenda-files t)))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7175 (ctf (file-truename buffer-file-name))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7176 x had)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7177 (setq x (assoc ctf file-alist) had x)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7178
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7179 (if (not x) (setq x (cons ctf (abbreviate-file-name buffer-file-name))))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7180 (if to-end
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7181 (setq file-alist (append (delq x file-alist) (list x)))
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7182 (setq file-alist (cons x (delq x file-alist))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7183 (org-store-new-agenda-file-list (mapcar 'cdr file-alist))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7184 (org-install-agenda-files-menu)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7185 (message "File %s to %s of agenda file list"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
7186 (if had "moved" "added") (if to-end "end" "front"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7187
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7188 (defun org-remove-file (&optional file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7189 "Remove current file from the list of files in variable `org-agenda-files'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7190 These are the files which are being checked for agenda entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7191 Optional argument FILE means, use this file instead of the current."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7192 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7193 (let* ((file (or file buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7194 (true-file (file-truename file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7195 (afile (abbreviate-file-name file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7196 (files (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7197 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7198 (if (equal true-file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7199 (file-truename x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7200 nil x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7201 (org-agenda-files t)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7202 (if (not (= (length files) (length (org-agenda-files t))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7203 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7204 (org-store-new-agenda-file-list files)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7205 (org-install-agenda-files-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7206 (message "Removed file: %s" afile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7207 (message "File was not in list: %s" afile))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7208
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7209 (defun org-file-menu-entry (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7210 (vector file (list 'find-file file) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7211
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7212 (defun org-get-all-dates (beg end &optional no-ranges force-today inactive empty)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7213 "Return a list of all relevant day numbers from BEG to END buffer positions.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7214 If NO-RANGES is non-nil, include only the start and end dates of a range,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7215 not every single day in the range. If FORCE-TODAY is non-nil, make
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7216 sure that TODAY is included in the list. If INACTIVE is non-nil, also
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7217 inactive time stamps (those in square brackets) are included.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7218 When EMPTY is non-nil, also include days without any entries."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7219 (let ((re (if inactive org-ts-regexp-both org-ts-regexp))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7220 dates dates1 date day day1 day2 ts1 ts2)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7221 (if force-today
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7222 (setq dates (list (time-to-days (current-time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7223 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7224 (goto-char beg)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7225 (while (re-search-forward re end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7226 (setq day (time-to-days (org-time-string-to-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7227 (substring (match-string 1) 0 10))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7228 (or (memq day dates) (push day dates)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7229 (unless no-ranges
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7230 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7231 (while (re-search-forward org-tr-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7232 (setq ts1 (substring (match-string 1) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7233 ts2 (substring (match-string 2) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7234 day1 (time-to-days (org-time-string-to-time ts1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7235 day2 (time-to-days (org-time-string-to-time ts2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7236 (while (< (setq day1 (1+ day1)) day2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7237 (or (memq day1 dates) (push day1 dates)))))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7238 (setq dates (sort dates '<))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7239 (when empty
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7240 (while (setq day (pop dates))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7241 (setq day2 (car dates))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7242 (push day dates1)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7243 (when (and day2 empty)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7244 (if (or (eq empty t)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7245 (and (numberp empty) (<= (- day2 day) empty)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7246 (while (< (setq day (1+ day)) day2)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7247 (push (list day) dates1))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7248 (push (cons :omitted (- day2 day)) dates1))))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7249 (setq dates (nreverse dates1)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7250 dates)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7251
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7252 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7253 (defun org-diary (&rest args)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7254 "Return diary information from org-files.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
7255 This function can be used in a \"sexp\" diary entry in the Emacs calendar.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7256 It accesses org files and extracts information from those files to be
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7257 listed in the diary. The function accepts arguments specifying what
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7258 items should be listed. The following arguments are allowed:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7259
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7260 :timestamp List the headlines of items containing a date stamp or
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7261 date range matching the selected date. Deadlines will
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7262 also be listed, on the expiration day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7263
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7264 :deadline List any deadlines past due, or due within
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7265 `org-deadline-warning-days'. The listing occurs only
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7266 in the diary for *today*, not at any other date. If
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7267 an entry is marked DONE, it is no longer listed.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7268
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7269 :scheduled List all items which are scheduled for the given date.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7270 The diary for *today* also contains items which were
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7271 scheduled earlier and are not yet marked DONE.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7272
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7273 :todo List all TODO items from the org-file. This may be a
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7274 long list - so this is not turned on by default.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7275 Like deadlines, these entries only show up in the
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7276 diary for *today*, not at any other date.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7277
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7278 The call in the diary file should look like this:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7279
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7280 &%%(org-diary) ~/path/to/some/orgfile.org
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7281
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7282 Use a separate line for each org file to check. Or, if you omit the file name,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7283 all files listed in `org-agenda-files' will be checked automatically:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7284
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7285 &%%(org-diary)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7286
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7287 If you don't give any arguments (as in the example above), the default
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7288 arguments (:deadline :scheduled :timestamp) are used. So the example above may
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7289 also be written as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7290
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7291 &%%(org-diary :deadline :timestamp :scheduled)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7292
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7293 The function expects the lisp variables `entry' and `date' to be provided
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7294 by the caller, because this is how the calendar works. Don't use this
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7295 function from a program - use `org-agenda-get-day-entries' instead."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7296 (org-agenda-maybe-reset-markers)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
7297 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7298 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7299 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7300 (list entry)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7301 (org-agenda-files t)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7302 file rtn results)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7303 ;; If this is called during org-agenda, don't return any entries to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7304 ;; the calendar. Org Agenda will list these entries itself.
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7305 (if org-disable-agenda-to-diary (setq files nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7306 (while (setq file (pop files))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7307 (setq rtn (apply 'org-agenda-get-day-entries file date args))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7308 (setq results (append results rtn)))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7309 (if results
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
7310 (concat (org-finalize-agenda-entries results) "\n"))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7311 (defvar org-category-table nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7312 (defun org-get-category-table ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7313 "Get the table of categories and positions in current buffer."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7314 (let (tbl)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7315 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7316 (goto-char (point-min))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
7317 (while (re-search-forward "\\(^\\|\r\\)#\\+CATEGORY:[ \t]*\\(.*\\)" nil t)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
7318 (push (cons (point) (org-trim (match-string 2))) tbl)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7319 tbl))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7320 (defun org-get-category (&optional pos)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7321 "Get the category applying to position POS."
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7322 (if (not org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7323 (cond
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7324 ((null org-category)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7325 (setq org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7326 (if buffer-file-name
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7327 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7328 (file-name-nondirectory buffer-file-name))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7329 "???")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7330 ((symbolp org-category) (symbol-name org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7331 (t org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7332 (let ((tbl org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7333 (pos (or pos (point))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7334 (while (and tbl (> (caar tbl) pos))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7335 (pop tbl))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7336 (or (cdar tbl) (cdr (nth (1- (length org-category-table))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7337 org-category-table))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7338
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7339 (defun org-agenda-get-day-entries (file date &rest args)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7340 "Does the work for `org-diary' and `org-agenda'.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7341 FILE is the path to a file to be checked for entries. DATE is date like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7342 the one returned by `calendar-current-date'. ARGS are symbols indicating
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7343 which kind of entries should be extracted. For details about these, see
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7344 the documentation of `org-diary'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7345 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7346 (let* ((org-startup-with-deadline-check nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7347 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7348 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7349 (buffer (if (file-exists-p file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7350 (org-get-agenda-file-buffer file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7351 (error "No such file %s" file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7352 arg results rtn)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7353 (if (not buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7354 ;; If file does not exist, make sure an error message ends up in diary
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7355 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7356 (with-current-buffer buffer
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
7357 (unless (org-mode-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7358 (error "Agenda file %s is not in `org-mode'" file))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7359 (setq org-category-table (org-get-category-table))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7360 (let ((case-fold-search nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7361 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7362 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7363 (if org-respect-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7364 (if (org-region-active-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7365 ;; Respect a region to restrict search
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7366 (narrow-to-region (region-beginning) (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7367 ;; If we work for the calendar or many files,
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7368 ;; get rid of any restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7369 (widen))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7370 ;; The way we repeatedly append to `results' makes it O(n^2) :-(
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7371 (while (setq arg (pop args))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7372 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7373 ((and (eq arg :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7374 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7375 (setq rtn (org-agenda-get-todos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7376 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7377 ((eq arg :timestamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7378 (setq rtn (org-agenda-get-blocks))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7379 (setq results (append results rtn))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7380 (setq rtn (org-agenda-get-timestamps))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7381 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7382 ((eq arg :scheduled)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7383 (setq rtn (org-agenda-get-scheduled))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7384 (setq results (append results rtn)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7385 ((eq arg :closed)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7386 (setq rtn (org-agenda-get-closed))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7387 (setq results (append results rtn)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7388 ((and (eq arg :deadline)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7389 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7390 (setq rtn (org-agenda-get-deadlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7391 (setq results (append results rtn))))))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7392 results))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7393
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7394 (defun org-entry-is-done-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7395 "Is the current entry marked DONE?"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7396 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7397 (and (re-search-backward "[\r\n]\\*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7398 (looking-at org-nl-done-regexp))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7399
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7400 (defun org-at-date-range-p ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
7401 "Is the cursor inside a date range?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7402 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7403 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7404 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7405 (let ((pos (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7406 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7407 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7408 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7409 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7410 (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7411 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7412 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7413 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7414 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7415 (throw 'exit t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7416 nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7417
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7418 (defun org-agenda-get-todos ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7419 "Return the TODO information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7420 (let* ((props (list 'face nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7421 'done-face 'org-done
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7422 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7423 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7424 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7425 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7426 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7427 (abbreviate-file-name buffer-file-name))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7428 (regexp (concat "[\n\r]\\*+ *\\("
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7429 (if org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7430 (concat "\\<\\(" org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7431 "\\)\\>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7432 org-not-done-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7433 "[^\n\r]*\\)"))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7434 (sched-re (concat ".*\n?.*?" org-scheduled-time-regexp))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7435 marker priority category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7436 ee txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7437 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7438 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7439 (catch :skip
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
7440 (when (and org-agenda-todo-ignore-scheduled
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
7441 (looking-at sched-re))
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
7442 ;; FIXME: the following test also happens below, but we need it here
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
7443 (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
7444 (throw :skip nil))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7445 (org-agenda-skip)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7446 (goto-char (match-beginning 1))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7447 (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7448 category (org-get-category)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7449 tags (org-get-tags-at (point))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7450 txt (org-format-agenda-item "" (match-string 1) category tags)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7451 priority
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7452 (+ (org-get-priority txt)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7453 (if org-todo-kwd-priority-p
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7454 (- org-todo-kwd-max-priority -2
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7455 (length
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7456 (member (match-string 2) org-todo-keywords)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7457 1)))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7458 (org-add-props txt props
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7459 'org-marker marker 'org-hd-marker marker
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7460 'priority priority 'category category)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7461 (push txt ee)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7462 (if org-agenda-todo-list-sublevels
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7463 (goto-char (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7464 (org-end-of-subtree 'invisible))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7465 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7466
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7467 (defconst org-agenda-no-heading-message
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7468 "No heading for this item in buffer or region.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7469
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7470 (defun org-agenda-get-timestamps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7471 "Return the date stamp information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7472 (let* ((props (list 'face nil
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7473 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7474 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7475 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7476 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7477 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7478 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7479 (regexp (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7480 (substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7481 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7482 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7483 (apply 'encode-time ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7484 (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7485 0 11)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7486 marker hdmarker deadlinep scheduledp donep tmp priority category
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7487 ee txt timestr tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7488 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7489 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7490 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7491 (and (save-match-data (org-at-date-range-p)) (throw :skip nil))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7492 (org-agenda-skip)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7493 (setq marker (org-agenda-new-marker (match-beginning 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7494 category (org-get-category (match-beginning 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7495 tmp (buffer-substring (max (point-min)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7496 (- (match-beginning 0)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7497 org-ds-keyword-length))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7498 (match-beginning 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7499 timestr (buffer-substring (match-beginning 0) (point-at-eol))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7500 deadlinep (string-match org-deadline-regexp tmp)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7501 scheduledp (string-match org-scheduled-regexp tmp)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7502 donep (org-entry-is-done-p))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7503 (if (string-match ">" timestr)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7504 ;; substring should only run to end of time stamp
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7505 (setq timestr (substring timestr 0 (match-end 0))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7506 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7507 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7508 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7509 (goto-char (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7510 (setq hdmarker (org-agenda-new-marker)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7511 tags (org-get-tags-at))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7512 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7513 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7514 (format "%s%s"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7515 (if deadlinep "Deadline: " "")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7516 (if scheduledp "Scheduled: " ""))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7517 (match-string 1) category tags timestr)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7518 (setq txt org-agenda-no-heading-message))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7519 (setq priority (org-get-priority txt))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7520 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7521 'org-marker marker 'org-hd-marker hdmarker)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7522 (if deadlinep
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7523 (org-add-props txt nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7524 'face (if donep 'org-done 'org-warning)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7525 'undone-face 'org-warning 'done-face 'org-done
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7526 'category category 'priority (+ 100 priority))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7527 (if scheduledp
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7528 (org-add-props txt nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7529 'face 'org-scheduled-today
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7530 'undone-face 'org-scheduled-today 'done-face 'org-done
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7531 'category category 'priority (+ 99 priority))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7532 (org-add-props txt nil 'priority priority 'category category)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7533 (push txt ee))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7534 (outline-next-heading)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7535 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7536
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7537 (defun org-agenda-get-closed ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7538 "Return the logged TODO entries for agenda display."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7539 (let* ((props (list 'mouse-face 'highlight
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7540 'org-not-done-regexp org-not-done-regexp
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7541 'keymap org-agenda-keymap
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7542 'help-echo
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7543 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7544 (abbreviate-file-name buffer-file-name))))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7545 (regexp (concat
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
7546 "\\<\\(" org-closed-string "\\|" org-clock-string "\\) *\\["
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7547 (regexp-quote
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7548 (substring
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7549 (format-time-string
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7550 (car org-time-stamp-formats)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7551 (apply 'encode-time ; DATE bound by calendar
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7552 (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7553 1 11))))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
7554 marker hdmarker priority category tags closedp
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7555 ee txt timestr)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7556 (goto-char (point-min))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7557 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7558 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7559 (org-agenda-skip)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7560 (setq marker (org-agenda-new-marker (match-beginning 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7561 closedp (equal (match-string 1) org-closed-string)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7562 category (org-get-category (match-beginning 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7563 timestr (buffer-substring (match-beginning 0) (point-at-eol))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7564 ;; donep (org-entry-is-done-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7565 )
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7566 (if (string-match "\\]" timestr)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7567 ;; substring should only run to end of time stamp
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7568 (setq timestr (substring timestr 0 (match-end 0))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7569 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7570 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7571 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7572 (goto-char (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7573 (setq hdmarker (org-agenda-new-marker)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7574 tags (org-get-tags-at))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7575 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7576 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7577 (if closedp "Closed: " "Clocked: ")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7578 (match-string 1) category tags timestr)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7579 (setq txt org-agenda-no-heading-message))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7580 (setq priority 100000)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7581 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7582 'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7583 'priority priority 'category category
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7584 'undone-face 'org-warning 'done-face 'org-done)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7585 (push txt ee))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7586 (outline-next-heading)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7587 (nreverse ee)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
7588
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7589 (defun org-agenda-get-deadlines ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7590 "Return the deadline information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7591 (let* ((wdays org-deadline-warning-days)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7592 (props (list 'mouse-face 'highlight
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7593 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7594 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7595 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7596 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7597 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7598 (regexp org-deadline-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7599 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7600 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7601 d2 diff pos pos1 category tags
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7602 ee txt head face)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7603 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7604 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7605 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7606 (org-agenda-skip)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7607 (setq pos (1- (match-beginning 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7608 d2 (time-to-days
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7609 (org-time-string-to-time (match-string 1)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7610 diff (- d2 d1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7611 ;; When to show a deadline in the calendar:
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7612 ;; If the expiration is within wdays warning time.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7613 ;; Past-due deadlines are only shown on the current date
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7614 (if (and (< diff wdays) todayp (not (= diff 0)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7615 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7616 (setq category (org-get-category))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7617 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7618 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7619 (goto-char (match-end 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7620 (setq pos1 (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7621 (setq tags (org-get-tags-at pos1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7622 (setq head (buffer-substring-no-properties
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7623 (point)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7624 (progn (skip-chars-forward "^\r\n")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7625 (point))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7626 (if (string-match org-looking-at-done-regexp head)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7627 (setq txt nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7628 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7629 (format "In %3d d.: " diff) head category tags))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7630 (setq txt org-agenda-no-heading-message))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7631 (when txt
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7632 (setq face (cond ((<= diff 0) 'org-warning)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7633 ((<= diff 5) 'org-upcoming-deadline)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7634 (t nil)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7635 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7636 'org-marker (org-agenda-new-marker pos)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7637 'org-hd-marker (org-agenda-new-marker pos1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7638 'priority (+ (- 10 diff) (org-get-priority txt))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7639 'category category
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7640 'face face 'undone-face face 'done-face 'org-done)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7641 (push txt ee))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7642 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7643
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7644 (defun org-agenda-get-scheduled ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7645 "Return the scheduled information for agenda display."
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
7646 (let* ((props (list 'face 'org-scheduled-previously
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7647 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7648 'undone-face 'org-scheduled-previously
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7649 'done-face 'org-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7650 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7651 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7652 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7653 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7654 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7655 (regexp org-scheduled-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7656 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7657 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7658 d2 diff pos pos1 category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7659 ee txt head)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7660 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7661 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7662 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7663 (org-agenda-skip)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7664 (setq pos (1- (match-beginning 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7665 d2 (time-to-days
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7666 (org-time-string-to-time (match-string 1)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7667 diff (- d2 d1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7668 ;; When to show a scheduled item in the calendar:
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7669 ;; If it is on or past the date.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7670 (if (and (< diff 0) todayp)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7671 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7672 (setq category (org-get-category))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7673 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7674 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7675 (goto-char (match-end 0))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7676 (setq pos1 (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7677 (setq tags (org-get-tags-at))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7678 (setq head (buffer-substring-no-properties
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7679 (point)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7680 (progn (skip-chars-forward "^\r\n") (point))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7681 (if (string-match org-looking-at-done-regexp head)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7682 (setq txt nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7683 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7684 (format "Sched.%2dx: " (- 1 diff)) head
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7685 category tags))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7686 (setq txt org-agenda-no-heading-message))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7687 (when txt
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7688 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7689 'org-marker (org-agenda-new-marker pos)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7690 'org-hd-marker (org-agenda-new-marker pos1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7691 'priority (+ (- 5 diff) (org-get-priority txt))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7692 'category category)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7693 (push txt ee))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7694 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7695
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7696 (defun org-agenda-get-blocks ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7697 "Return the date-range information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7698 (let* ((props (list 'face nil
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7699 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7700 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7701 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7702 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7703 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7704 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7705 (regexp org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7706 (d0 (calendar-absolute-from-gregorian date))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7707 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7708 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7709 (while (re-search-forward regexp nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7710 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7711 (org-agenda-skip)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7712 (setq timestr (match-string 0)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7713 s1 (match-string 1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7714 s2 (match-string 2)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7715 d1 (time-to-days (org-time-string-to-time s1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7716 d2 (time-to-days (org-time-string-to-time s2)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7717 (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7718 ;; Only allow days between the limits, because the normal
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7719 ;; date stamps will catch the limits.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7720 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7721 (setq marker (org-agenda-new-marker (point)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7722 (setq category (org-get-category))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7723 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7724 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7725 (setq hdmarker (org-agenda-new-marker (match-end 1)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7726 (goto-char (match-end 1))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7727 (setq tags (org-get-tags-at))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7728 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7729 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7730 (format (if (= d1 d2) "" "(%d/%d): ")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7731 (1+ (- d0 d1)) (1+ (- d2 d1)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7732 (match-string 1) category tags
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7733 (if (= d0 d1) timestr))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7734 (setq txt org-agenda-no-heading-message))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7735 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7736 'org-marker marker 'org-hd-marker hdmarker
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7737 'priority (org-get-priority txt) 'category category)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7738 (push txt ee)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
7739 (outline-next-heading)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7740 ;; Sort the entries by expiration date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7741 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7742
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7743 (defconst org-plain-time-of-day-regexp
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7744 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7745 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7746 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7747 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7748 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7749 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7750 "\\)?")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7751 "Regular expression to match a plain time or time range.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7752 Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7753 groups carry important information:
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7754 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7755 1 the first time, range or not
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7756 8 the second time, if it is a range.")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7757
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7758 (defconst org-stamp-time-of-day-regexp
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7759 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7760 "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +[a-zA-Z]+ +\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7761 "\\([012][0-9]:[0-5][0-9]\\)>"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7762 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7763 "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7764 "Regular expression to match a timestamp time or time range.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7765 After a match, the following groups carry important information:
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7766 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7767 1 date plus weekday, for backreferencing to make sure both times on same day
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7768 2 the first time, range or not
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7769 4 the second time, if it is a range.")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7770
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7771 (defvar org-prefix-has-time nil
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7772 "A flag, set by `org-compile-prefix-format'.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7773 The flag is set if the currently compiled format contains a `%t'.")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7774 (defvar org-prefix-has-tag nil
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7775 "A flag, set by `org-compile-prefix-format'.
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7776 The flag is set if the currently compiled format contains a `%T'.")
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7777
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7778 (defun org-format-agenda-item (extra txt &optional category tags dotime noprefix)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7779 "Format TXT to be inserted into the agenda buffer.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7780 In particular, it adds the prefix and corresponding text properties. EXTRA
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7781 must be a string and replaces the `%s' specifier in the prefix format.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7782 CATEGORY (string, symbol or nil) may be used to overrule the default
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7783 category taken from local variable or file name. It will replace the `%c'
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7784 specifier in the format. DOTIME, when non-nil, indicates that a
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7785 time-of-day should be extracted from TXT for sorting of this entry, and for
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7786 the `%t' specifier in the format. When DOTIME is a string, this string is
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7787 searched for a time before TXT is. NOPREFIX is a flag and indicates that
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7788 only the correctly processes TXT should be returned - this is used by
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7789 `org-agenda-change-all-lines'. TAG can be the tag of the headline."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7790 (save-match-data
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7791 ;; Diary entries sometimes have extra whitespace at the beginning
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7792 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt)))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7793 (let* ((category (or category
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7794 org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7795 (if buffer-file-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7796 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7797 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7798 "")))
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
7799 (tag (if tags (nth (1- (length tags)) tags) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7800 time ;; needed for the eval of the prefix format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7801 (ts (if dotime (concat (if (stringp dotime) dotime "") txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7802 (time-of-day (and dotime (org-get-time-of-day ts)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7803 stamp plain s0 s1 s2 rtn)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7804 (when (and dotime time-of-day org-prefix-has-time)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7805 ;; Extract starting and ending time and move them to prefix
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7806 (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7807 (setq plain (string-match org-plain-time-of-day-regexp ts)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7808 (setq s0 (match-string 0 ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7809 s1 (match-string (if plain 1 2) ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7810 s2 (match-string (if plain 8 4) ts))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7811
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7812 ;; If the times are in TXT (not in DOTIMES), and the prefix will list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7813 ;; them, we might want to remove them there to avoid duplication.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7814 ;; The user can turn this off with a variable.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7815 (if (and org-agenda-remove-times-when-in-prefix (or stamp plain)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7816 (string-match (concat (regexp-quote s0) " *") txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7817 (if (eq org-agenda-remove-times-when-in-prefix 'beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7818 (= (match-beginning 0) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7819 t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7820 (setq txt (replace-match "" nil nil txt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7821 ;; Normalize the time(s) to 24 hour
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7822 (if s1 (setq s1 (org-get-time-of-day s1 'string t)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7823 (if s2 (setq s2 (org-get-time-of-day s2 'string t))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7824
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7825 (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7826 ;; Tags are in the string
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7827 (if (or (eq org-agenda-remove-tags-when-in-prefix t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7828 (and org-agenda-remove-tags-when-in-prefix
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7829 org-prefix-has-tag))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7830 (setq txt (replace-match "" t t txt))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
7831 (setq txt (replace-match
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7832 (concat (make-string (max (- 50 (length txt)) 1) ?\ )
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7833 (match-string 2 txt))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
7834 t t txt))))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7835
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7836 ;; Create the final string
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7837 (if noprefix
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7838 (setq rtn txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7839 ;; Prepare the variables needed in the eval of the compiled format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7840 (setq time (cond (s2 (concat s1 "-" s2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7841 (s1 (concat s1 "......"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7842 (t ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7843 extra (or extra "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7844 category (if (symbolp category) (symbol-name category) category))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7845 ;; Evaluate the compiled format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7846 (setq rtn (concat (eval org-prefix-format-compiled) txt)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7847
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7848 ;; And finally add the text properties
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7849 (org-add-props rtn nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7850 'category (downcase category) 'tags tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7851 'prefix-length (- (length rtn) (length txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7852 'time-of-day time-of-day
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7853 'dotime dotime))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7854
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7855 (defun org-agenda-add-time-grid-maybe (list ndays todayp)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7856 (catch 'exit
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7857 (cond ((not org-agenda-use-time-grid) (throw 'exit list))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7858 ((and todayp (member 'today (car org-agenda-time-grid))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7859 ((and (= ndays 1) (member 'daily (car org-agenda-time-grid))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7860 ((member 'weekly (car org-agenda-time-grid)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7861 (t (throw 'exit list)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7862 (let* ((have (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7863 (lambda (x) (get-text-property 1 'time-of-day x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7864 list)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7865 (string (nth 1 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7866 (gridtimes (nth 2 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7867 (req (car org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7868 (remove (member 'remove-match req))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7869 new time)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7870 (if (and (member 'require-timed req) (not have))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7871 ;; don't show empty grid
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7872 (throw 'exit list))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7873 (while (setq time (pop gridtimes))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7874 (unless (and remove (member time have))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7875 (setq time (int-to-string time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7876 (push (org-format-agenda-item
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7877 nil string "" nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7878 (concat (substring time 0 -2) ":" (substring time -2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7879 new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7880 (put-text-property
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7881 1 (length (car new)) 'face 'org-time-grid (car new))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7882 (if (member 'time-up org-agenda-sorting-strategy)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7883 (append new list)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7884 (append list new)))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7885
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7886 (defun org-compile-prefix-format (format)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7887 "Compile the prefix format into a Lisp form that can be evaluated.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7888 The resulting form is returned and stored in the variable
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7889 `org-prefix-format-compiled'."
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7890 (setq org-prefix-has-time nil org-prefix-has-tag nil)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7891 (let ((start 0) varform vars var (s format)e c f opt)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7892 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7893 s start)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7894 (setq var (cdr (assoc (match-string 4 s)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7895 '(("c" . category) ("t" . time) ("s" . extra)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7896 ("T" . tag))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7897 c (or (match-string 3 s) "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7898 opt (match-beginning 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7899 start (1+ (match-beginning 0)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7900 (if (equal var 'time) (setq org-prefix-has-time t))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7901 (if (equal var 'tag) (setq org-prefix-has-tag t))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7902 (setq f (concat "%" (match-string 2 s) "s"))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7903 (if opt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7904 (setq varform
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7905 `(if (equal "" ,var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7906 ""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7907 (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7908 (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c)))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7909 (setq s (replace-match "%s" t nil s))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7910 (push varform vars))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7911 (setq vars (nreverse vars))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7912 (setq org-prefix-format-compiled `(format ,s ,@vars))))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7913
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7914 (defun org-get-time-of-day (s &optional string mod24)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7915 "Check string S for a time of day.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7916 If found, return it as a military time number between 0 and 2400.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7917 If not found, return nil.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7918 The optional STRING argument forces conversion into a 5 character wide string
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7919 HH:MM."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7920 (save-match-data
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7921 (when
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7922 (or
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7923 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7924 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7925 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7926 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7927 (let* ((h (string-to-number (match-string 1 s)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7928 (m (if (match-end 3) (string-to-number (match-string 3 s)) 0))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7929 (ampm (if (match-end 4) (downcase (match-string 4 s))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7930 (am-p (equal ampm "am"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7931 (h1 (cond ((not ampm) h)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7932 ((= h 12) (if am-p 0 12))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7933 (t (+ h (if am-p 0 12)))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7934 (h2 (if (and string mod24 (not (and (= m 0) (= h1 24))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7935 (mod h1 24) h1))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7936 (t0 (+ (* 100 h2) m))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7937 (t1 (concat (if (>= h1 24) "+" " ")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7938 (if (< t0 100) "0" "")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7939 (if (< t0 10) "0" "")
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7940 (int-to-string t0))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
7941 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7942
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7943 (defun org-finalize-agenda-entries (list)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7944 "Sort and concatenate the agenda items."
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7945 (setq list (mapcar 'org-agenda-highlight-todo list))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7946 (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7947
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7948 (defun org-agenda-highlight-todo (x)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7949 (let (re pl)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7950 (if (eq x 'line)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7951 (save-excursion
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7952 (beginning-of-line 1)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7953 (setq re (get-text-property (point) 'org-not-done-regexp))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7954 (goto-char (+ (point) (get-text-property (point) 'prefix-length)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7955 (and (looking-at (concat "[ \t]*" re))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7956 (add-text-properties (match-beginning 0) (match-end 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7957 '(face org-todo))))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7958 (setq re (get-text-property 0 'org-not-done-regexp x)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7959 pl (get-text-property 0 'prefix-length x))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
7960 (and re (equal (string-match re x pl) pl)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7961 (add-text-properties (match-beginning 0) (match-end 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7962 '(face org-todo) x))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7963 x)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7964
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7965 (defsubst org-cmp-priority (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7966 "Compare the priorities of string A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7967 (let ((pa (or (get-text-property 1 'priority a) 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7968 (pb (or (get-text-property 1 'priority b) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7969 (cond ((> pa pb) +1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7970 ((< pa pb) -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7971 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7972
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7973 (defsubst org-cmp-category (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7974 "Compare the string values of categories of strings A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7975 (let ((ca (or (get-text-property 1 'category a) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7976 (cb (or (get-text-property 1 'category b) "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7977 (cond ((string-lessp ca cb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7978 ((string-lessp cb ca) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7979 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7980
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7981 (defsubst org-cmp-time (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7982 "Compare the time-of-day values of strings A and B."
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
7983 (let* ((def (if org-sort-agenda-notime-is-late 9901 -1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7984 (ta (or (get-text-property 1 'time-of-day a) def))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7985 (tb (or (get-text-property 1 'time-of-day b) def)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7986 (cond ((< ta tb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7987 ((< tb ta) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7988 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7989
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7990 (defun org-entries-lessp (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7991 "Predicate for sorting agenda entries."
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7992 ;; The following variables will be used when the form is evaluated.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7993 (let* ((time-up (org-cmp-time a b))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7994 (time-down (if time-up (- time-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7995 (priority-up (org-cmp-priority a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7996 (priority-down (if priority-up (- priority-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7997 (category-up (org-cmp-category a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7998 (category-down (if category-up (- category-up) nil))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7999 (category-keep (if category-up +1 nil)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8000 (cdr (assoc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8001 (eval (cons 'or org-agenda-sorting-strategy))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8002 '((-1 . t) (1 . nil) (nil . nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8003
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8004 (defun org-agenda-show-priority ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8005 "Show the priority of the current item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8006 This priority is composed of the main priority given with the [#A] cookies,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8007 and by additional input from the age of a schedules or deadline entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8008 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8009 (let* ((pri (get-text-property (point-at-bol) 'priority)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8010 (message "Priority is %d" (if pri pri -1000))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8011
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8012 (defun org-agenda-show-tags ()
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8013 "Show the tags applicable to the current item."
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8014 (interactive)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8015 (let* ((tags (get-text-property (point-at-bol) 'tags)))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8016 (if tags
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8017 (message "Tags are :%s:"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8018 (org-no-properties (mapconcat 'identity tags ":")))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8019 (message "No tags associated with this line"))))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8020
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8021 (defun org-agenda-goto (&optional highlight)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8022 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8023 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8024 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8025 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8026 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8027 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8028 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8029 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8030 (goto-char pos)
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
8031 (when (org-mode-p)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8032 (org-show-hidden-entry)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8033 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8034 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8035 (org-flag-heading nil)))) ; show the next heading
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8036 (and highlight (org-highlight (point-at-bol) (point-at-eol)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8037
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8038 (defun org-agenda-switch-to ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8039 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8040 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8041 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8042 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8043 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8044 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8045 (switch-to-buffer buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8046 (delete-other-windows)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8047 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8048 (goto-char pos)
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
8049 (when (org-mode-p)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8050 (org-show-hidden-entry)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8051 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8052 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8053 (org-flag-heading nil)))))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8054
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8055 (defun org-agenda-goto-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8056 "Go to the Org-mode file which contains the item at the mouse click."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8057 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8058 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8059 (org-agenda-goto))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8060
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8061 (defun org-agenda-show ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8062 "Display the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8063 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8064 (let ((win (selected-window)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8065 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8066 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8067
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8068 (defun org-agenda-recenter (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8069 "Display the Org-mode file which contains the item at point and recenter."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8070 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8071 (let ((win (selected-window)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8072 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8073 (recenter arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8074 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8075
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8076 (defun org-agenda-show-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8077 "Display the Org-mode file which contains the item at the mouse click."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8078 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8079 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8080 (org-agenda-show))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8081
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8082 (defun org-agenda-check-no-diary ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8083 "Check if the entry is a diary link and abort if yes."
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8084 (if (get-text-property (point) 'org-agenda-diary-link)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8085 (org-agenda-error)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8086
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8087 (defun org-agenda-error ()
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
8088 (error "Command not allowed in this line"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8089
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8090 (defvar org-last-heading-marker (make-marker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8091 "Marker pointing to the headline that last changed its TODO state
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8092 by a remote command from the agenda.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8093
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8094 (defun org-agenda-todo (&optional arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8095 "Cycle TODO state of line at point, also in Org-mode file.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8096 This changes the line at point, all other lines in the agenda referring to
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8097 the same tree node, and the headline of the tree node in the Org-mode file."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8098 (interactive "P")
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8099 (org-agenda-check-no-diary)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8100 (let* ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8101 (marker (or (get-text-property (point) 'org-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8102 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8103 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8104 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8105 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8106 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8107 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8108 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8109 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8110 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8111 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8112 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8113 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8114 (org-flag-heading nil))) ; show the next heading
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8115 (org-todo arg)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8116 (and (bolp) (forward-char 1))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8117 (setq newhead (org-get-heading))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8118 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8119 (org-back-to-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8120 (move-marker org-last-heading-marker (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8121 (beginning-of-line 1)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8122 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8123 (org-agenda-change-all-lines newhead hdmarker 'fixface))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8124 (move-to-column col)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8125
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8126 (defun org-agenda-change-all-lines (newhead hdmarker &optional fixface)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8127 "Change all lines in the agenda buffer which match HDMARKER.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8128 The new content of the line will be NEWHEAD (as modified by
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8129 `org-format-agenda-item'). HDMARKER is checked with
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8130 `equal' against all `org-hd-marker' text properties in the file.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8131 If FIXFACE is non-nil, the face of each item is modified acording to
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8132 the new TODO state."
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8133 (let* (props m pl undone-face done-face finish new dotime cat tags)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8134 ; (setq newhead (org-format-agenda-item "x" newhead "x" nil 'noprefix))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8135 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8136 (goto-char (point-max))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8137 (beginning-of-line 1)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8138 (while (not finish)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8139 (setq finish (bobp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8140 (when (and (setq m (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8141 (equal m hdmarker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8142 (setq props (text-properties-at (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8143 dotime (get-text-property (point) 'dotime)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8144 cat (get-text-property (point) 'category)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8145 tags (get-text-property (point) 'tags)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
8146 new (org-format-agenda-item "x" newhead cat tags dotime 'noprefix)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8147 pl (get-text-property (point) 'prefix-length)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8148 undone-face (get-text-property (point) 'undone-face)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8149 done-face (get-text-property (point) 'done-face))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8150 (move-to-column pl)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8151 (if (looking-at ".*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8152 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8153 (replace-match new t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8154 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8155 (add-text-properties (point-at-bol) (point-at-eol) props)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8156 (when fixface
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8157 (add-text-properties
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8158 (point-at-bol) (point-at-eol)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8159 (list 'face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8160 (if org-last-todo-state-is-todo
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8161 undone-face done-face)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8162 (org-agenda-highlight-todo 'line))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8163 (beginning-of-line 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8164 (error "Line update did not work")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8165 (beginning-of-line 0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8166
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8167 (defun org-agenda-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8168 "Increase the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8169 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8170 (org-agenda-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8171
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8172 (defun org-agenda-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8173 "Decrease the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8174 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8175 (org-agenda-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8176
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8177 (defun org-agenda-priority (&optional force-direction)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8178 "Set the priority of line at point, also in Org-mode file.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8179 This changes the line at point, all other lines in the agenda referring to
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8180 the same tree node, and the headline of the tree node in the Org-mode file."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8181 (interactive)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8182 (org-agenda-check-no-diary)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8183 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8184 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8185 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8186 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8187 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8188 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8189 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8190 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8191 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8192 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8193 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8194 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8195 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8196 (org-flag-heading nil))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8197 (funcall 'org-priority force-direction)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8198 (end-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8199 (setq newhead (org-get-heading)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8200 (org-agenda-change-all-lines newhead hdmarker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8201 (beginning-of-line 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8202
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8203 (defun org-get-tags-at (&optional pos)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8204 "Get a list of all headline tags applicable at POS.
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8205 POS defaults to point. If tags are inherited, the list contains
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8206 the targets in the same sequence as the headlines appear, i.e.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8207 the tags of the current headline come last."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8208 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8209 (let (tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8210 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8211 (goto-char (or pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8212 (save-match-data
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8213 (org-back-to-heading t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8214 (condition-case nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8215 (while t
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8216 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8217 (setq tags (append (org-split-string
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8218 (org-match-string-no-properties 1) ":")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8219 tags)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8220 (or org-use-tag-inheritance (error ""))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8221 (org-up-heading-all 1))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8222 (error nil))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8223 (message "%s" tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8224 tags))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8225
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8226 (defun org-agenda-set-tags ()
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8227 "Set tags for the current headline."
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8228 (interactive)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8229 (org-agenda-check-no-diary)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8230 (org-agenda-show) ;;; FIXME This is a stupid hack and should not be needed
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8231 (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8232 (org-agenda-error)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8233 (buffer (marker-buffer hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8234 (pos (marker-position hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8235 (buffer-read-only nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8236 newhead)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8237 (with-current-buffer buffer
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8238 (widen)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8239 (goto-char pos)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8240 (org-show-hidden-entry)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8241 (save-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8242 (and (outline-next-heading)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8243 (org-flag-heading nil))) ; show the next heading
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8244 (call-interactively 'org-set-tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8245 (end-of-line 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8246 (setq newhead (org-get-heading)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8247 (org-agenda-change-all-lines newhead hdmarker)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8248 (beginning-of-line 1)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8249
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8250 (defun org-agenda-date-later (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8251 "Change the date of this item to one day later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8252 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8253 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8254 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8255 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8256 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8257 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8258 (pos (marker-position marker)))
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
8259 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8260 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8261 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8262 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8263 (error "Cannot find time stamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8264 (org-timestamp-change arg (or what 'day))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8265 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8266
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8267 (defun org-agenda-date-earlier (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8268 "Change the date of this item to one day earlier."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8269 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8270 (org-agenda-date-later (- arg) what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8271
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8272 (defun org-agenda-date-prompt (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8273 "Change the date of this item. Date is prompted for, with default today.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8274 The prefix ARG is passed to the `org-time-stamp' command and can therefore
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8275 be used to request time specification in the time stamp."
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8276 (interactive "P")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8277 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8278 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8279 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8280 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8281 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8282 (pos (marker-position marker)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8283 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8284 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8285 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8286 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8287 (error "Cannot find time stamp"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8288 (org-time-stamp arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8289 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8290
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8291 (defun org-agenda-schedule (arg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8292 "Schedule the item at point."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8293 (interactive "P")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8294 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8295 (org-agenda-check-no-diary)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8296 (let* ((marker (or (get-text-property (point) 'org-marker)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8297 (org-agenda-error)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8298 (buffer (marker-buffer marker))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8299 (pos (marker-position marker))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8300 (org-insert-labeled-timestamps-at-point nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8301 ts)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8302 (with-current-buffer buffer
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8303 (widen)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8304 (goto-char pos)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8305 (setq ts (org-schedule))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8306 (message "Item scheduled for %s" ts))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8307
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8308 (defun org-agenda-deadline (arg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8309 "Schedule the item at point."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8310 (interactive "P")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8311 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8312 (org-agenda-check-no-diary)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8313 (let* ((marker (or (get-text-property (point) 'org-marker)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8314 (org-agenda-error)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8315 (buffer (marker-buffer marker))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8316 (pos (marker-position marker))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8317 (org-insert-labeled-timestamps-at-point nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8318 ts)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8319 (with-current-buffer buffer
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8320 (widen)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8321 (goto-char pos)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8322 (setq ts (org-deadline))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8323 (message "Deadline for this item set to %s" ts))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8324
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8325 (defun org-get-heading ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8326 "Return the heading of the current entry, without the stars."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8327 (save-excursion
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8328 (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8329 (if (and (re-search-backward "[\r\n]\\*" nil t)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8330 (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8331 (match-string 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8332 "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8333
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8334 (defun org-agenda-clock-in (&optional arg)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8335 "Start the clock on the currently selected item."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8336 (interactive "P")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8337 (org-agenda-check-no-diary)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8338 (let* ((marker (or (get-text-property (point) 'org-marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8339 (org-agenda-error)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8340 (pos (marker-position marker)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8341 (with-current-buffer (marker-buffer marker)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8342 (widen)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8343 (goto-char pos)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8344 (org-clock-in))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8345
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8346 (defun org-agenda-diary-entry ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8347 "Make a diary entry, like the `i' command from the calendar.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8348 All the standard commands work: block, weekly etc."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8349 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8350 (org-agenda-check-type t 'agenda 'timeline)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8351 (require 'diary-lib)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8352 (let* ((char (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8353 (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8354 (read-char-exclusive)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8355 (cmd (cdr (assoc char
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8356 '((?d . insert-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8357 (?w . insert-weekly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8358 (?m . insert-monthly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8359 (?y . insert-yearly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8360 (?a . insert-anniversary-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8361 (?b . insert-block-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8362 (?c . insert-cyclic-diary-entry)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8363 (oldf (symbol-function 'calendar-cursor-to-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8364 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8365 (mark (or (mark t) (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8366 (unless cmd
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8367 (error "No command associated with <%c>" char))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8368 (unless (and (get-text-property point 'day)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8369 (or (not (equal ?b char))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8370 (get-text-property mark 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8371 (error "Don't know which date to use for diary entry"))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8372 ;; We implement this by hacking the `calendar-cursor-to-date' function
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8373 ;; and the `calendar-mark-ring' variable. Saves a lot of code.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8374 (let ((calendar-mark-ring
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8375 (list (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8376 (or (get-text-property mark 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8377 (get-text-property point 'day))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8378 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8379 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8380 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8381 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8382 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8383 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8384 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8385 (fset 'calendar-cursor-to-date oldf)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8386
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8387
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8388 (defun org-agenda-execute-calendar-command (cmd)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8389 "Execute a calendar command from the agenda, with the date associated to
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8390 the cursor position."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8391 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8392 (require 'diary-lib)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8393 (unless (get-text-property (point) 'day)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8394 (error "Don't know which date to use for calendar command"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8395 (let* ((oldf (symbol-function 'calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8396 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8397 (date (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8398 (get-text-property point 'day)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8399 (displayed-day (extract-calendar-day date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8400 (displayed-month (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8401 (displayed-year (extract-calendar-year date)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8402 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8403 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8404 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8405 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8406 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8407 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8408 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8409 (fset 'calendar-cursor-to-date oldf))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8410
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8411 (defun org-agenda-phases-of-moon ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8412 "Display the phases of the moon for the 3 months around the cursor date."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8413 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8414 (org-agenda-execute-calendar-command 'calendar-phases-of-moon))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8415
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8416 (defun org-agenda-holidays ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8417 "Display the holidays for the 3 months around the cursor date."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8418 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8419 (org-agenda-execute-calendar-command 'list-calendar-holidays))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8420
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8421 (defun org-agenda-sunrise-sunset (arg)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8422 "Display sunrise and sunset for the cursor date.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8423 Latitude and longitude can be specified with the variables
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8424 `calendar-latitude' and `calendar-longitude'. When called with prefix
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8425 argument, latitude and longitude will be prompted for."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8426 (interactive "P")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8427 (let ((calendar-longitude (if arg nil calendar-longitude))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8428 (calendar-latitude (if arg nil calendar-latitude))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8429 (calendar-location-name
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8430 (if arg "the given coordinates" calendar-location-name)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8431 (org-agenda-execute-calendar-command 'calendar-sunrise-sunset)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8432
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8433 (defun org-agenda-goto-calendar ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8434 "Open the Emacs calendar with the date at the cursor."
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8435 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8436 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8437 (let* ((day (or (get-text-property (point) 'day)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8438 (error "Don't know which date to open in calendar")))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
8439 (date (calendar-gregorian-from-absolute day))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
8440 (calendar-move-hook nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
8441 (view-calendar-holidays-initially nil)
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
8442 (view-diary-entries-initially nil))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
8443 (calendar)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8444 (calendar-goto-date date)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8445
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8446 (defun org-calendar-goto-agenda ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8447 "Compute the Org-mode agenda for the calendar date displayed at the cursor.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8448 This is a command that has to be installed in `calendar-mode-map'."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8449 (interactive)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8450 (org-agenda-list nil (calendar-absolute-from-gregorian
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8451 (calendar-cursor-to-date))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8452 nil t))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8453
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8454 (defun org-agenda-convert-date ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8455 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8456 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8457 (let ((day (get-text-property (point) 'day))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8458 date s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8459 (unless day
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8460 (error "Don't know which date to convert"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8461 (setq date (calendar-gregorian-from-absolute day))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8462 (setq s (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8463 "Gregorian: " (calendar-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8464 "ISO: " (calendar-iso-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8465 "Day of Yr: " (calendar-day-of-year-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8466 "Julian: " (calendar-julian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8467 "Astron. JD: " (calendar-astro-date-string date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8468 " (Julian date number at noon UTC)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8469 "Hebrew: " (calendar-hebrew-date-string date) " (until sunset)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8470 "Islamic: " (calendar-islamic-date-string date) " (until sunset)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8471 "French: " (calendar-french-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8472 "Mayan: " (calendar-mayan-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8473 "Coptic: " (calendar-coptic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8474 "Ethiopic: " (calendar-ethiopic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8475 "Persian: " (calendar-persian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8476 "Chinese: " (calendar-chinese-date-string date) "\n"))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8477 (with-output-to-temp-buffer "*Dates*"
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8478 (princ s))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8479 (if (fboundp 'fit-window-to-buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8480 (fit-window-to-buffer (get-buffer-window "*Dates*")))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8481
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8482 ;;; Tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8483
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8484 (defun org-scan-tags (action matcher &optional todo-only)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8485 "Scan headline tags with inheritance and produce output ACTION.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8486 ACTION can be `sparse-tree' or `agenda'. MATCHER is a Lisp form to be
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8487 evaluated, testing if a given set of tags qualifies a headline for
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8488 inclusion. When TODO-ONLY is non-nil, only lines with a TODO keyword
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8489 are included in the output."
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8490 (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8491 (mapconcat 'regexp-quote
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8492 (nreverse (cdr (reverse org-todo-keywords)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8493 "\\|")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8494 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*[\n\r]"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8495 (props (list 'face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8496 'done-face 'org-done
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8497 'undone-face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8498 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8499 'keymap org-agenda-keymap
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8500 'help-echo
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8501 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8502 (abbreviate-file-name buffer-file-name))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8503 lspos
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8504 tags tags-list tags-alist (llast 0) rtn level category i txt
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8505 todo marker)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8506 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8507 (goto-char (point-min))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8508 (when (eq action 'sparse-tree) (org-overview))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8509 (while (re-search-forward re nil t)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8510 (catch :skip
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8511 (and (eq action 'agenda) (org-agenda-skip))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8512 (setq todo (if (match-end 1) (match-string 2))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8513 tags (if (match-end 4) (match-string 4)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8514 (goto-char (setq lspos (1+ (match-beginning 0))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8515 (setq level (funcall outline-level)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8516 category (org-get-category))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8517 (setq i llast llast level)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8518 ;; remove tag lists from same and sublevels
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8519 (while (>= i level)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8520 (when (setq entry (assoc i tags-alist))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8521 (setq tags-alist (delete entry tags-alist)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8522 (setq i (1- i)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8523 ;; add the nex tags
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8524 (when tags
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8525 (setq tags (mapcar 'downcase (org-split-string tags ":"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8526 tags-alist
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8527 (cons (cons level tags) tags-alist)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8528 ;; compile tags for current headline
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8529 (setq tags-list
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8530 (if org-use-tag-inheritance
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8531 (apply 'append (mapcar 'cdr tags-alist))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8532 tags))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8533 (when (and (or (not todo-only) todo)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8534 (eval matcher)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8535 (or (not org-agenda-skip-archived-trees)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8536 (not (member org-archive-tag tags-list))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8537 ;; list this headline
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8538 (if (eq action 'sparse-tree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8539 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8540 (org-show-hierarchy-above))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8541 (setq txt (org-format-agenda-item
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8542 ""
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8543 (concat
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8544 (if org-tags-match-list-sublevels
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8545 (make-string (1- level) ?.) "")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8546 (org-get-heading))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8547 category tags-list))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8548 (goto-char lspos)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8549 (setq marker (org-agenda-new-marker))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8550 (org-add-props txt props
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8551 'org-marker marker 'org-hd-marker marker 'category category)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8552 (push txt rtn))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8553 ;; if we are to skip sublevels, jump to end of subtree
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8554 (point)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8555 (or org-tags-match-list-sublevels (org-end-of-subtree))))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8556 (when (and (eq action 'sparse-tree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8557 (not org-sparse-tree-open-archived-trees))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8558 (org-hide-archived-subtrees (point-min) (point-max)))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8559 (nreverse rtn)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8560
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8561 (defun org-tags-sparse-tree (&optional arg match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8562 "Create a sparse tree according to tags search string MATCH.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8563 MATCH can contain positive and negative selection of tags, like
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8564 \"+WORK+URGENT-WITHBOSS\"."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8565 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8566 (let ((org-show-following-heading nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8567 (org-show-hierarchy-above nil))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8568 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8569
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8570 (defun org-make-tags-matcher (match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8571 "Create the TAGS matcher form for the tags-selecting string MATCH."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8572 (unless match
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8573 ;; Get a new match request, with completion
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8574 (setq org-last-tags-completion-table
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8575 (or (org-get-buffer-tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8576 org-last-tags-completion-table))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8577 (setq match (completing-read
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8578 "Tags: " 'org-tags-completion-function nil nil nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8579 'org-tags-history)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8580 ;; parse the string and create a lisp form
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8581 (let ((match0 match) minus tag mm matcher orterms term orlist)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8582 (setq orterms (org-split-string match "|"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8583 (while (setq term (pop orterms))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8584 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_@0-9]+\\)" term)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8585 (setq minus (and (match-end 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8586 (equal (match-string 1 term) "-"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8587 tag (match-string 2 term)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8588 term (substring term (match-end 0))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8589 mm (list 'member (downcase tag) 'tags-list)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8590 mm (if minus (list 'not mm) mm))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8591 (push mm matcher))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8592 (push (if (> (length matcher) 1) (cons 'and matcher) (car matcher))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8593 orlist)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8594 (setq matcher nil))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8595 (setq matcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8596 ;; Return the string and lisp forms of the matcher
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8597 (cons match0 matcher)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8598
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8599 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8600 (defun org-tags-view (&optional todo-only match keep-modes)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8601 "Show all headlines for all `org-agenda-files' matching a TAGS criterion.
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8602 The prefix arg TODO-ONLY limits the search to TODO entries."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8603 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8604 (org-agenda-maybe-reset-markers 'force)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8605 (org-compile-prefix-format org-agenda-prefix-format)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8606 (let* ((org-agenda-keep-modes keep-modes)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8607 (org-tags-match-list-sublevels
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8608 (if todo-only t org-tags-match-list-sublevels))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8609 (win (selected-window))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8610 (completion-ignore-case t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8611 rtn rtnall files file pos matcher
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8612 buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8613 (setq matcher (org-make-tags-matcher match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8614 match (car matcher) matcher (cdr matcher))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8615 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8616 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8617 (delete-other-windows)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8618 (switch-to-buffer-other-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8619 (get-buffer-create org-agenda-buffer-name))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8620 (setq buffer-read-only nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8621 (erase-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8622 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8623 (set (make-local-variable 'org-agenda-type) 'tags)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8624 (set (make-local-variable 'org-agenda-redo-command)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8625 (list 'org-tags-view (list 'quote todo-only)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8626 (list 'if 'current-prefix-arg nil match) t))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8627 (setq files (org-agenda-files)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8628 rtnall nil)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8629 (org-prepare-agenda-buffers files)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8630 (while (setq file (pop files))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8631 (catch 'nextfile
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8632 (org-check-agenda-file file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8633 (setq buffer (if (file-exists-p file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8634 (org-get-agenda-file-buffer file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8635 (error "No such file %s" file)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8636 (if (not buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8637 ;; If file does not exist, merror message to agenda
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8638 (setq rtn (list
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8639 (format "ORG-AGENDA-ERROR: No such org-file %s" file))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8640 rtnall (append rtnall rtn))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8641 (with-current-buffer buffer
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
8642 (unless (org-mode-p)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8643 (error "Agenda file %s is not in `org-mode'" file))
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
8644 (setq org-category-table (org-get-category-table))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8645 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8646 (save-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8647 (if org-respect-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8648 (if (org-region-active-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8649 ;; Respect a region to restrict search
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8650 (narrow-to-region (region-beginning) (region-end)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8651 ;; If we work for the calendar or many files,
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8652 ;; get rid of any restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8653 (widen))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8654 (setq rtn (org-scan-tags 'agenda matcher todo-only))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8655 (setq rtnall (append rtnall rtn))))))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8656 (insert "Headlines with TAGS match: ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8657 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8658 (list 'face 'org-level-3))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8659 (setq pos (point))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8660 (insert match "\n")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8661 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8662 (setq pos (point))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8663 (insert "Press `C-u r' to search again with new search string\n")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8664 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8665 (when rtnall
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8666 (insert (mapconcat 'identity rtnall "\n")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8667 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8668 (setq buffer-read-only t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8669 (org-fit-agenda-window)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8670 (if (not org-select-agenda-window) (select-window win))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8671
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8672 (defvar org-add-colon-after-tag-completion nil) ;; dynamically skoped param
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8673 (defun org-set-tags (&optional arg just-align)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8674 "Set the tags for the current headline.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8675 With prefix ARG, realign all tags in headings in the current buffer."
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8676 (interactive "P")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8677 (let* ((re (concat "^" outline-regexp))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8678 (col (current-column))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8679 (current (org-get-tags))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8680 table current-tags inherited-tags ; computed below when needed
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8681 tags hd empty invis)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8682 (if arg
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8683 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8684 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8685 (while (re-search-forward re nil t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8686 (org-set-tags nil t))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8687 (message "All tags realigned to column %d" org-tags-column))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8688 (if just-align
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8689 (setq tags current)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8690 (setq table (or org-tag-alist (org-get-buffer-tags))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8691 org-last-tags-completion-table table
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8692 current-tags (org-split-string current ":")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8693 inherited-tags (nreverse
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8694 (nthcdr (length current-tags)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8695 (nreverse (org-get-tags-at))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8696 tags
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8697 (if (or (eq t org-use-fast-tag-selection)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8698 (and org-use-fast-tag-selection
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8699 (delq nil (mapcar 'cdr table))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8700 (org-fast-tag-selection current-tags inherited-tags table)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8701 (let ((org-add-colon-after-tag-completion t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8702 (completing-read "Tags: " 'org-tags-completion-function
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8703 nil nil current 'org-tags-history))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8704 (while (string-match "[-+&]+" tags)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
8705 (setq tags (replace-match ":" t t tags))))
71652
4df24233cf1e (org-agenda-get-todos): Skip subtree also if entry is
Carsten Dominik <dominik@science.uva.nl>
parents: 71567
diff changeset
8706
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
8707 (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
8708 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
8709 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8710 (if (equal current "")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8711 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
8712 (end-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8713 (or empty (insert-before-markers " ")))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8714 (beginning-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8715 (setq invis (org-invisible-p))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8716 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8717 (setq hd (match-string 1))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8718 (delete-region (match-beginning 0) (match-end 0))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8719 (insert-before-markers (org-trim hd) (if empty "" " ")))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8720 (if (equal tags "")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8721 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8722 (beginning-of-line 1)
71567
f008b5943ba4 (org-set-tags): Keep single space after stars.
Carsten Dominik <dominik@science.uva.nl>
parents: 71563
diff changeset
8723 (skip-chars-forward "*")
f008b5943ba4 (org-set-tags): Keep single space after stars.
Carsten Dominik <dominik@science.uva.nl>
parents: 71563
diff changeset
8724 (if (= (char-after) ?\ ) (forward-char 1))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8725 (and (re-search-forward "[ \t]+$" (point-at-eol) t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
8726 (replace-match "")))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8727 (move-to-column (max (current-column)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8728 (if (> org-tags-column 0)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8729 org-tags-column
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8730 (- (- org-tags-column) (length tags))))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8731 t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8732 (insert-before-markers tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8733 (if (and (not invis) (org-invisible-p))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8734 (outline-flag-region (point-at-bol) (point) nil)))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8735 (move-to-column col))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8736
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8737 (defun org-tags-completion-function (string predicate &optional flag)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8738 (let (s1 s2 rtn (ctable org-last-tags-completion-table)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8739 (confirm (lambda (x) (stringp (car x)))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
8740 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8741 (setq s1 (match-string 1 string)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8742 s2 (match-string 2 string))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8743 (setq s1 "" s2 string))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8744 (cond
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8745 ((eq flag nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8746 ;; try completion
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8747 (setq rtn (try-completion s2 ctable confirm))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8748 (if (stringp rtn)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8749 (concat s1 s2 (substring rtn (length s2))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8750 (if (and org-add-colon-after-tag-completion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8751 (assoc rtn ctable))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8752 ":" "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8753 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8754 ((eq flag t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8755 ;; all-completions
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8756 (all-completions s2 ctable confirm)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8757 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8758 ((eq flag 'lambda)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8759 ;; exact match?
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8760 (assoc s2 ctable)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8761 ))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8762
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8763 (defun org-fast-tag-insert (kwd tags face &optional end)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8764 "Insert KDW, and the TAGS, the latter with face FACE. Also inser END."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8765 (insert (format "%-12s" (concat kwd ":"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8766 (org-add-props (mapconcat 'identity tags " ") nil 'face face)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8767 (or end "")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8768
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8769 (defun org-fast-tag-selection (current inherited table)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8770 "Fast tag selection with single keys.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8771 CURRENT is the current list of tags in the headline, INHERITED is the
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8772 list of inherited tags, and TABLE is an alist of tags and corresponding keys,
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8773 possibly with grouping information.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8774 If the keys are nil, a-z are automatically assigned.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8775 Returns the new tags string, or nil to not change the current settings."
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8776 (let* ((maxlen (apply 'max (mapcar
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8777 (lambda (x)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8778 (if (stringp (car x)) (string-width (car x)) 0))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8779 table)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8780 (fwidth (+ maxlen 3 1 3))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8781 (ncol (/ (- (window-width) 4) fwidth))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8782 (i-face 'org-done)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8783 (c-face 'org-tag)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8784 tg cnt e c char c1 c2 ntable tbl rtn
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8785 groups ingroup)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8786 (save-window-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8787 (delete-other-windows)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8788 (split-window-vertically)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8789 (switch-to-buffer-other-window (get-buffer-create " *Org tags*"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8790 (erase-buffer)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8791 (org-fast-tag-insert "Inherited" inherited i-face "\n")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8792 (org-fast-tag-insert "Current" current c-face "\n\n")
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8793 (setq tbl table char ?a cnt 0)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8794 (while (setq e (pop tbl))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8795 (cond
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8796 ((equal e '(:startgroup))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8797 (push '() groups) (setq ingroup t)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8798 (when (not (= cnt 0))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8799 (setq cnt 0)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8800 (insert "\n"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8801 (insert "{ "))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8802 ((equal e '(:endgroup))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8803 (setq ingroup nil cnt 0)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8804 (insert "}\n"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8805 (t
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8806 (setq tg (car e) c2 nil)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8807 (if (cdr e)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8808 (setq c (cdr e))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8809 ;; automatically assign a character.
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8810 (setq c1 (string-to-char
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8811 (downcase (substring
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8812 tg (if (= (string-to-char tg) ?@) 1 0)))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8813 (if (or (rassoc c1 ntable) (rassoc c1 table))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8814 (while (or (rassoc char ntable) (rassoc char table))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8815 (setq char (1+ char)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8816 (setq c2 c1))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8817 (setq c (or c2 char)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8818 (if ingroup (push tg (car groups)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8819 (setq tg (org-add-props tg nil 'face
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8820 (cond
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8821 ((member tg current) c-face)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8822 ((member tg inherited) i-face)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8823 (t nil))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8824 (if (and (= cnt 0) (not ingroup)) (insert " "))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8825 (insert "[" c "] " tg (make-string
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8826 (- fwidth 4 (length tg)) ?\ ))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8827 (push (cons tg c) ntable)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8828 (when (= (setq cnt (1+ cnt)) ncol)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8829 (insert "\n")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8830 (if ingroup (insert " "))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8831 (setq cnt 0)))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8832 (setq ntable (nreverse ntable))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8833 (insert "\n")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8834 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8835 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8836 (setq rtn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8837 (catch 'exit
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8838 (while t
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8839 (message "[key]:Toggle SPC: clear current RET accept%s"
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8840 (if groups " [!] ignore goups" ""))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8841 (setq c (read-char-exclusive))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8842 (cond
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8843 ((= c ?\r) (throw 'exit t))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
8844 ((= c ?!)
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8845 (setq groups nil)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8846 (goto-char (point-min))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8847 (while (re-search-forward "[{}]" nil t) (replace-match " ")))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8848 ((or (= c ?\C-g)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8849 (and (= c ?q) (not (rassoc c ntable))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8850 (setq quit-flag t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8851 ((= c ?\ ) (setq current nil))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8852 ((setq e (rassoc c ntable) tg (car e))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8853 (if (member tg current)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8854 (setq current (delete tg current))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8855 (loop for g in groups do
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8856 (if (member tg g)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8857 (mapcar (lambda (x)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8858 (setq current (delete x current)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8859 g)))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8860 (setq current (cons tg current)))))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8861 ;; Create a sorted list
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8862 (setq current
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8863 (sort current
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8864 (lambda (a b)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
8865 (assoc b (cdr (memq (assoc a ntable) ntable))))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8866 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8867 (beginning-of-line 2)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8868 (delete-region (point) (point-at-eol))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8869 (org-fast-tag-insert "Current" current c-face)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8870 (while (re-search-forward "\\[.\\] \\([a-zA-Z0-9_@]+\\)" nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8871 (setq tg (match-string 1))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8872 (add-text-properties (match-beginning 1) (match-end 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8873 (list 'face
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8874 (cond
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8875 ((member tg current) c-face)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8876 ((member tg inherited) i-face)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8877 (t nil)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8878 (goto-char (point-min)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8879 (if rtn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8880 (mapconcat 'identity current ":")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8881 nil))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8882
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8883 (defun org-get-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8884 "Get the TAGS string in the current headline."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8885 (unless (org-on-heading-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8886 (error "Not on a heading"))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8887 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8888 (beginning-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8889 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8890 (org-match-string-no-properties 1)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8891 "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8892
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8893 (defun org-get-buffer-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8894 "Get a table of all tags used in the buffer, for completion."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8895 (let (tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8896 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8897 (goto-char (point-min))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8898 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8899 (mapc (lambda (x) (add-to-list 'tags x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8900 (org-split-string (org-match-string-no-properties 1) ":"))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8901 (mapcar 'list tags)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8902
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8903 ;;; Link Stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8904
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8905 (defvar org-create-file-search-functions nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8906 "List of functions to construct the right search string for a file link.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8907 These functions are called in turn with point at the location to
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8908 which the link should point.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8909
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8910 A function in the hook should first test if it would like to
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8911 handle this file type, for example by checking the major-mode or
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8912 the file extension. If it decides not to handle this file, it
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8913 should just return nil to give other functions a chance. If it
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8914 does handle the file, it must return the search string to be used
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8915 when following the link. The search string will be part of the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8916 file link, given after a double colon, and `org-open-at-point'
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8917 will automatically search for it. If special measures must be
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8918 taken to make the search successful, another function should be
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8919 added to the companion hook `org-execute-file-search-functions',
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8920 which see.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8921
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8922 A function in this hook may also use `setq' to set the variable
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8923 `description' to provide a suggestion for the descriptive text to
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8924 be used for this link when it gets inserted into an Org-mode
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8925 buffer with \\[org-insert-link].")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8926
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8927 (defvar org-execute-file-search-functions nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8928 "List of functions to execute a file search triggered by a link.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8929
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8930 Functions added to this hook must accept a single argument, the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8931 search string that was part of the file link, the part after the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8932 double colon. The function must first check if it would like to
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8933 handle this search, for example by checking the major-mode or the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8934 file extension. If it decides not to handle this search, it
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8935 should just return nil to give other functions a chance. If it
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8936 does handle the search, it must return a non-nil value to keep
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8937 other functions from trying.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8938
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8939 Each function can access the current prefix argument through the
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8940 variable `current-prefix-argument'. Note that a single prefix is
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8941 used to force opening a link in Emacs, so it may be good to only
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8942 use a numeric or double prefix to guide the search function.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8943
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8944 In case this is needed, a function in this hook can also restore
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8945 the window configuration before `org-open-at-point' was called using:
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8946
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8947 (set-window-configuration org-window-config-before-follow-link)")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8948
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8949 (defun org-find-file-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8950 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8951 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8952 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8953 (org-open-at-point 'in-emacs))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8954
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8955 (defun org-open-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8956 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8957 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8958 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8959 (org-open-at-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8960
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8961 (defvar org-window-config-before-follow-link nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8962 "The window configuration before following a link.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8963 This is saved in case the need arises to restore it.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8964
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8965 (defun org-open-at-point (&optional in-emacs)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8966 "Open link at or after point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8967 If there is no link at point, this function will search forward up to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8968 the end of the current subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8969 Normally, files will be opened by an appropriate application. If the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8970 optional argument IN-EMACS is non-nil, Emacs will visit the file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8971 (interactive "P")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
8972 (setq org-window-config-before-follow-link (current-window-configuration))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8973 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8974 (if (org-at-timestamp-p)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8975 (org-agenda-list nil (time-to-days (org-time-string-to-time
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8976 (substring (match-string 1) 0 10)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
8977 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8978 (let (type path link line search (pos (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8979 (catch 'match
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8980 (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8981 (skip-chars-forward "^]\n\r")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8982 (when (and (re-search-backward "\\[\\[" nil t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8983 (looking-at org-bracket-link-regexp)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8984 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8985 (>= (match-end 0) pos))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8986 (setq link (org-link-unescape (org-match-string-no-properties 1)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8987 (while (string-match " *\n *" link)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8988 (setq link (replace-match " " t t link)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8989 (if (string-match org-link-re-with-space2 link)
69620
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
8990 (setq type (match-string 1 link)
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
8991 path (match-string 2 link))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8992 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8993 path link))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8994 (throw 'match t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8995
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8996 (when (get-text-property (point) 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8997 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8998 pos (if (get-text-property (1+ (point)) 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8999 (1+ (point)) (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9000 path (buffer-substring
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9001 (previous-single-property-change pos 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9002 (next-single-property-change pos 'org-linked-text)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9003 (throw 'match t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9004
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9005 (save-excursion
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9006 (skip-chars-backward (concat "^[]" org-non-link-chars " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9007 (if (equal (char-before) ?<) (backward-char 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9008 (when (or (looking-at org-angle-link-re)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9009 (looking-at org-plain-link-re)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9010 (and (or (re-search-forward org-angle-link-re (point-at-eol) t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9011 (re-search-forward org-plain-link-re (point-at-eol) t))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
9012 (<= (match-beginning 0) pos)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
9013 (>= (match-end 0) pos)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9014 (setq type (match-string 1)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9015 path (match-string 2))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9016 (throw 'match t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9017 (save-excursion
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9018 (skip-chars-backward "^ \t\n\r")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9019 (when (looking-at "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9020 (setq type "tags"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9021 path (match-string 1))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9022 (while (string-match ":" path)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9023 (setq path (replace-match "+" t t path)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9024 (throw 'match t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9025 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9026 (skip-chars-backward "a-zA-Z_")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9027 (when (and (memq 'camel org-activate-links)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9028 (looking-at org-camel-regexp))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9029 (setq type "camel" path (match-string 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9030 (if (equal (char-before) ?*)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9031 (setq path (concat "*" path))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9032 (throw 'match t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9033 (unless path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9034 (error "No link found"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9035 ;; Remove any trailing spaces in path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9036 (if (string-match " +\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9037 (setq path (replace-match "" t t path)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9038
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9039 (cond
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9040
69620
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
9041 ((member type '("http" "https" "ftp" "mailto" "news"))
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
9042 (browse-url (concat type ":" path)))
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
9043
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
9044 ((string= type "tags")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
9045 (org-tags-view in-emacs path))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9046 ((or (string= type "camel")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9047 (string= type "thisfile"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9048 (org-mark-ring-push)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9049 (org-link-search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9050 path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9051 (cond ((equal in-emacs '(4)) 'occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9052 ((equal in-emacs '(16)) 'org-occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9053 (t nil))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9054
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9055 ((string= type "file")
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
9056 (if (string-match "::\\([0-9]+\\)\\'" path)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9057 (setq line (string-to-number (match-string 1 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9058 path (substring path 0 (match-beginning 0)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9059 (if (string-match "::\\(.+\\)\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9060 (setq search (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9061 path (substring path 0 (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9062 (org-open-file path in-emacs line search))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9063
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9064 ((string= type "news")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9065 (org-follow-gnus-link path))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9066
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9067 ((string= type "bbdb")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9068 (org-follow-bbdb-link path))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9069
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9070 ((string= type "info")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9071 (org-follow-info-link path))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9072
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9073 ((string= type "gnus")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9074 (let (group article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9075 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9076 (error "Error in Gnus link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9077 (setq group (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9078 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9079 (org-follow-gnus-link group article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9080
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9081 ((string= type "vm")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9082 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9083 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9084 (error "Error in VM link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9085 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9086 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9087 ;; in-emacs is the prefix arg, will be interpreted as read-only
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9088 (org-follow-vm-link folder article in-emacs)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9089
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9090 ((string= type "wl")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9091 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9092 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9093 (error "Error in Wanderlust link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9094 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9095 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9096 (org-follow-wl-link folder article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9097
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9098 ((string= type "mhe")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9099 (let (folder article)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9100 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9101 (error "Error in MHE link"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9102 (setq folder (match-string 1 path)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9103 article (match-string 3 path))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9104 (org-follow-mhe-link folder article)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9105
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9106 ((string= type "rmail")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9107 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9108 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9109 (error "Error in RMAIL link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9110 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9111 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9112 (org-follow-rmail-link folder article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9113
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9114 ((string= type "shell")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9115 (let ((cmd path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9116 (while (string-match "@{" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9117 (setq cmd (replace-match "<" t t cmd)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9118 (while (string-match "@}" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9119 (setq cmd (replace-match ">" t t cmd)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9120 (if (or (not org-confirm-shell-link-function)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9121 (funcall org-confirm-shell-link-function
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9122 (format "Execute \"%s\" in shell? "
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9123 (org-add-props cmd nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9124 'face 'org-warning))))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
9125 (progn
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
9126 (message "Executing %s" cmd)
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
9127 (shell-command cmd))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9128 (error "Abort"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9129
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9130 ((string= type "elisp")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9131 (let ((cmd path))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9132 (if (or (not org-confirm-elisp-link-function)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9133 (funcall org-confirm-elisp-link-function
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9134 (format "Execute \"%s\" as elisp? "
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9135 (org-add-props cmd nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9136 'face 'org-warning))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9137 (message "%s => %s" cmd (eval (read cmd)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9138 (error "Abort"))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9139
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9140 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9141 (browse-url-at-point))))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9142
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9143 (defun org-link-search (s &optional type)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9144 "Search for a link search option.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9145 When S is a CamelCaseWord, search for a target, or for a sentence containing
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9146 the words. If S is surrounded by forward slashes, it is interpreted as a
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9147 regular expression. In org-mode files, this will create an `org-occur'
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9148 sparse tree. In ordinary files, `occur' will be used to list matches.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9149 If the current buffer is in `dired-mode', grep will be used to search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9150 in all files."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9151 (let ((case-fold-search t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9152 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9153 (pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9154 (pre "") (post "")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9155 words re0 re1 re2 re3 re4 re5 re2a reall camel)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9156 (cond
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
9157 ;; First check if there are any special
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9158 ((run-hook-with-args-until-success 'org-execute-file-search-functions s))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9159 ;; Now try the builtin stuff
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9160 ((save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9161 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9162 (and
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9163 (re-search-forward
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9164 (concat "<<" (regexp-quote s0) ">>") nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9165 (setq pos (match-beginning 0))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9166 ;; There is an exact target for this
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9167 (goto-char pos))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9168 ((string-match "^/\\(.*\\)/$" s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9169 ;; A regular expression
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9170 (cond
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
9171 ((org-mode-p)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9172 (org-occur (match-string 1 s)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9173 ;;((eq major-mode 'dired-mode)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9174 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9175 (t (org-do-occur (match-string 1 s)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9176 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9177 t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9178 ;; A camel or a normal search string
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9179 (when (equal (string-to-char s) ?*)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9180 ;; Anchor on headlines, post may include tags.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9181 (setq pre "^\\*+[ \t]*\\(?:\\sw+\\)?[ \t]*"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9182 post "[ \t]*\\(?:[ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9183 s (substring s 1)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9184 (remove-text-properties
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9185 0 (length s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9186 '(face nil mouse-face nil keymap nil fontified nil) s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9187 ;; Make a series of regular expressions to find a match
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9188 (setq words
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9189 (if camel
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9190 (org-camel-to-words s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9191 (org-split-string s "[ \n\r\t]+"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9192 re0 (concat "\\(<<" (regexp-quote s0) ">>\\)")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9193 re2 (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t]+") "\\)[ \t\r\n]")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9194 re2a (concat "[ \t\r\n]\\(" (mapconcat 'downcase words "[ \t\r\n]+") "\\)[ \t\r\n]")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9195 re4 (concat "[^a-zA-Z_]\\(" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\)[^a-zA-Z_]")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9196 re1 (concat pre re2 post)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9197 re3 (concat pre re4 post)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9198 re5 (concat pre ".*" re4)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9199 re2 (concat pre re2)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9200 re2a (concat pre re2a)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9201 re4 (concat pre re4)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9202 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9203 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\("
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9204 re5 "\\)"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9205 ))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9206 (cond
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9207 ((eq type 'org-occur) (org-occur reall))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9208 ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9209 (t (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9210 (if (or (org-search-not-link re0 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9211 (org-search-not-link re1 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9212 (org-search-not-link re2 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9213 (org-search-not-link re2a nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9214 (org-search-not-link re3 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9215 (org-search-not-link re4 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9216 (org-search-not-link re5 nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9217 )
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
9218 (goto-char (match-beginning 1))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9219 (goto-char pos)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9220 (error "No match")))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9221 (t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9222 ;; Normal string-search
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9223 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9224 (if (search-forward s nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9225 (goto-char (match-beginning 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9226 (error "No match"))))
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
9227 (and (org-mode-p) (org-show-hierarchy-above))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9228
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9229 (defun org-search-not-link (&rest args)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9230 "Execute `re-search-forward', but only accept matches that are not a link."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9231 (catch 'exit
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9232 (let (p1)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9233 (while (apply 're-search-forward args)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9234 (setq p1 (point))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9235 (if (not (save-match-data
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9236 (and (re-search-backward "\\[\\[" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9237 (looking-at org-bracket-link-regexp)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9238 (<= (match-beginning 0) p1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9239 (>= (match-end 0) p1))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9240 (progn (goto-char (match-end 0))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9241 (throw 'exit (point)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9242 (goto-char (match-end 0)))))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9243
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9244 (defun org-do-occur (regexp &optional cleanup)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9245 "Call the Emacs command `occur'.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9246 If CLEANUP is non-nil, remove the printout of the regular expression
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9247 in the *Occur* buffer. This is useful if the regex is long and not useful
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9248 to read."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9249 (occur regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9250 (when cleanup
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9251 (let ((cwin (selected-window)) win beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9252 (when (setq win (get-buffer-window "*Occur*"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9253 (select-window win))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9254 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9255 (when (re-search-forward "match[a-z]+" nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9256 (setq beg (match-end 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9257 (if (re-search-forward "^[ \t]*[0-9]+" nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9258 (setq end (1- (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9259 (and beg end (let ((buffer-read-only)) (delete-region beg end)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9260 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9261 (select-window cwin))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9262
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9263 (defvar org-mark-ring nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9264 "Mark ring for positions before jumps in Org-mode.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9265 (defvar org-mark-ring-last-goto nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9266 "Last position in the mark ring used to go back.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9267 ;; Fill and close the ring
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9268 (setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9269 (loop for i from 1 to org-mark-ring-length do
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9270 (push (make-marker) org-mark-ring))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9271 (setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9272 org-mark-ring)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9273
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9274 (defun org-mark-ring-push (&optional pos buffer)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9275 "Put the current position or POS into the mark ring and rotate it."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9276 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9277 (setq pos (or pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9278 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9279 (move-marker (car org-mark-ring)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9280 (or pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9281 (or buffer (current-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9282 (message
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9283 (substitute-command-keys
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9284 "Position saved to mark ring, go back with \\[org-mark-ring-goto].")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9285
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9286 (defun org-mark-ring-goto (&optional n)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9287 "Jump to the previous position in the mark ring.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9288 With prefix arg N, jump back that many stored positions. When
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9289 called several times in succession, walk through the entire ring.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9290 Org-mode commands jumping to a different position in the current file,
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9291 or to another Org-mode file, automatically push the old position
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9292 onto the ring."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9293 (interactive "p")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9294 (let (p m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9295 (if (eq last-command this-command)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9296 (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9297 (setq p org-mark-ring))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9298 (setq org-mark-ring-last-goto p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9299 (setq m (car p))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9300 (switch-to-buffer (marker-buffer m))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9301 (goto-char m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9302 (if (or (org-invisible-p) (org-invisible-p2)) (org-show-hierarchy-above))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9303
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9304 (defun org-camel-to-words (s)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9305 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9306 (let ((case-fold-search nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9307 words)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9308 (while (string-match "[a-z][A-Z]" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9309 (push (substring s 0 (1+ (match-beginning 0))) words)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9310 (setq s (substring s (1+ (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9311 (nreverse (cons s words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9312
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9313 (defun org-remove-angle-brackets (s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9314 (if (equal (substring s 0 1) "<") (setq s (substring s 1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9315 (if (equal (substring s -1) ">") (setq s (substring s 0 -1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9316 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9317 (defun org-add-angle-brackets (s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9318 (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9319 (if (equal (substring s -1) ">") nil (setq s (concat s ">")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9320 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9321
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9322 (defun org-follow-bbdb-link (name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9323 "Follow a BBDB link to NAME."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9324 (require 'bbdb)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9325 (let ((inhibit-redisplay t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9326 (bbdb-electric-p nil))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9327 (catch 'exit
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9328 ;; Exact match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9329 (bbdb-name (concat "\\`" name "\\'") nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9330 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9331 ;; Exact match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9332 (bbdb-company (concat "\\`" name "\\'") nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9333 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9334 ;; Partial match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9335 (bbdb-name name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9336 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9337 ;; Partial match on company
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9338 (bbdb-company name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9339 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9340 ;; General match including network address and notes
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9341 (bbdb name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9342 (when (= 0 (buffer-size (get-buffer "*BBDB*")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9343 (delete-window (get-buffer-window "*BBDB*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9344 (error "No matching BBDB record")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9345
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9346
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9347 (defun org-follow-info-link (name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9348 "Follow an info file & node link to NAME."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9349 (if (or (string-match "\\(.*\\)::?\\(.*\\)" name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9350 (string-match "\\(.*\\)" name))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9351 (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9352 (require 'info)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9353 (if (match-string 2 name) ; If there isn't a node, choose "Top"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9354 (Info-find-node (match-string 1 name) (match-string 2 name))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9355 (Info-find-node (match-string 1 name) "Top")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9356 (message (concat "Could not open: " name))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9357
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9358 (defun org-follow-gnus-link (&optional group article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9359 "Follow a Gnus link to GROUP and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9360 (require 'gnus)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9361 (funcall (cdr (assq 'gnus org-link-frame-setup)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9362 (if group (gnus-fetch-group group))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9363 (if article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9364 (or (gnus-summary-goto-article article nil 'force)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9365 (if (fboundp 'gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9366 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9367 (gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9368 (gnus-summary-goto-article article nil 'force))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9369 (message "Message could not be found.")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9370
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9371 (defun org-follow-vm-link (&optional folder article readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9372 "Follow a VM link to FOLDER and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9373 (require 'vm)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9374 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9375 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9376 ;; ange-ftp or efs or tramp access
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9377 (let ((user (or (match-string 1 folder) (user-login-name)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9378 (host (match-string 2 folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9379 (file (match-string 3 folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9380 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9381 ((featurep 'tramp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9382 ;; use tramp to access the file
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9383 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9384 (setq folder (format "[%s@%s]%s" user host file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9385 (setq folder (format "/%s@%s:%s" user host file))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9386 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9387 ;; use ange-ftp or efs
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9388 (require (if (featurep 'xemacs) 'efs 'ange-ftp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9389 (setq folder (format "/%s@%s:%s" user host file))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9390 (when folder
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9391 (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9392 (sit-for 0.1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9393 (when article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9394 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9395 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9396 (let ((case-fold-search t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9397 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9398 (if (not (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9399 (concat "^" "message-id: *" (regexp-quote article))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9400 (error "Could not find the specified message in this folder"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9401 (vm-isearch-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9402 (vm-isearch-narrow)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9403 (vm-beginning-of-message)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9404 (vm-summarize)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9405
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9406 (defun org-follow-wl-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9407 "Follow a Wanderlust link to FOLDER and ARTICLE."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9408 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9409 (wl-summary-goto-folder-subr folder 'no-sync t nil t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9410 (if article (wl-summary-jump-to-msg-by-message-id article ">"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9411 (wl-summary-redisplay))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9412
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9413 (defun org-follow-rmail-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9414 "Follow an RMAIL link to FOLDER and ARTICLE."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9415 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9416 (let (message-number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9417 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9418 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9419 (rmail (if (string= folder "RMAIL") rmail-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9420 (setq message-number
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9421 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9422 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9423 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9424 (if (re-search-backward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9425 (concat "^Message-ID:\\s-+" (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9426 (or article "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9427 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9428 (rmail-what-message))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9429 (if message-number
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9430 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9431 (rmail (if (string= folder "RMAIL") rmail-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9432 (rmail-show-message message-number)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9433 message-number)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9434 (error "Message not found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9435
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9436 ;; mh-e integration based on planner-mode
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9437 (defun org-mhe-get-message-real-folder ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9438 "Return the name of the current message real folder, so if you use
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9439 sequences, it will now work."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9440 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9441 (let* ((folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9442 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9443 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9444 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9445 mh-show-folder-buffer))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9446 (end-index
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9447 (if (boundp 'mh-index-folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9448 (min (length mh-index-folder) (length folder))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9449 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9450 ;; a simple test on mh-index-data does not work, because
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9451 ;; mh-index-data is always nil in a show buffer.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9452 (if (and (boundp 'mh-index-folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9453 (string= mh-index-folder (substring folder 0 end-index)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9454 (if (equal major-mode 'mh-show-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9455 (save-window-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9456 (when (buffer-live-p (get-buffer folder))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9457 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9458 (pop-to-buffer folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9459 (org-mhe-get-message-folder-from-index)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9460 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9461 ))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9462 (org-mhe-get-message-folder-from-index)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9463 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9464 folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9465 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9466 )))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9467
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9468 (defun org-mhe-get-message-folder-from-index ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9469 "Returns the name of the message folder in a index folder buffer."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9470 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9471 (mh-index-previous-folder)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9472 (re-search-forward "^\\(+.*\\)$" nil t)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9473 (message (match-string 1))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9474
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9475 (defun org-mhe-get-message-folder ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9476 "Return the name of the current message folder. Be careful if you
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9477 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9478 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9479 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9480 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9481 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9482 mh-show-folder-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9483
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9484 (defun org-mhe-get-message-num ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9485 "Return the number of the current message. Be careful if you
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9486 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9487 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9488 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9489 (mh-get-msg-num nil)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9490 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9491 (mh-show-buffer-message-number))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9492
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9493 (defun org-mhe-get-header (header)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
9494 "Return a header of the message in folder mode. This will create a
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
9495 show buffer for the corresponding message. If you have a more clever
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9496 idea..."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9497 (let* ((folder (org-mhe-get-message-folder))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9498 (num (org-mhe-get-message-num))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9499 (buffer (get-buffer-create (concat "show-" folder)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9500 (header-field))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9501 (with-current-buffer buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9502 (mh-display-msg num folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9503 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9504 (mh-header-display)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9505 (mh-show-header-display))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9506 (set-buffer buffer)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9507 (setq header-field (mh-get-header-field header))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9508 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9509 (mh-show)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9510 (mh-show-show))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9511 header-field)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9512
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9513 (defun org-follow-mhe-link (folder article)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9514 "Follow an MHE link to FOLDER and ARTICLE.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9515 If ARTICLE is nil FOLDER is shown. If the configuration variable
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9516 `org-mhe-search-all-folders' is t and `mh-searcher' is pick,
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9517 ARTICLE is searched in all folders. Indexed searches (swish++,
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9518 namazu, and others supported by MH-E) will always search in all
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9519 folders."
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
9520 (require 'mh-e)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9521 (require 'mh-search)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9522 (require 'mh-utils)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
9523 (mh-find-path)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9524 (if (not article)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9525 (mh-visit-folder (mh-normalize-folder-name folder))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9526 (setq article (org-add-angle-brackets article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9527 (mh-search-choose)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9528 (if (equal mh-searcher 'pick)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9529 (progn
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9530 (mh-search folder (list "--message-id" article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9531 (when (and org-mhe-search-all-folders
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9532 (not (org-mhe-get-message-real-folder)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9533 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9534 (mh-search "+" (list "--message-id" article))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9535 (mh-search "+" article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9536 (if (org-mhe-get-message-real-folder)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9537 (mh-show-msg 1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9538 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
9539 (error "Message not found"))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9540
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9541 ;; BibTeX links
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9542
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9543 ;; Use the custom search meachnism to construct and use search strings for
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9544 ;; file links to BibTeX database entries.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9545
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9546 (defun org-create-file-search-in-bibtex ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9547 "Create the search string and description for a BibTeX database entry."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9548 (when (eq major-mode 'bibtex-mode)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9549 ;; yes, we want to construct this search string.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9550 ;; Make a good description for this entry, using names, year and the title
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9551 ;; Put it into the `description' variable which is dynamically scoped.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9552 (let ((bibtex-autokey-names 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9553 (bibtex-autokey-names-stretch 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9554 (bibtex-autokey-name-case-convert-function 'identity)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9555 (bibtex-autokey-name-separator " & ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9556 (bibtex-autokey-additional-names " et al.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9557 (bibtex-autokey-year-length 4)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9558 (bibtex-autokey-name-year-separator " ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9559 (bibtex-autokey-titlewords 3)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9560 (bibtex-autokey-titleword-separator " ")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9561 (bibtex-autokey-titleword-case-convert-function 'identity)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9562 (bibtex-autokey-titleword-length 'infty)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9563 (bibtex-autokey-year-title-separator ": "))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9564 (setq description (bibtex-generate-autokey)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9565 ;; Now parse the entry, get the key and return it.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9566 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9567 (bibtex-beginning-of-entry)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9568 (cdr (assoc "=key=" (bibtex-parse-entry))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9569
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9570 (defun org-execute-file-search-in-bibtex (s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9571 "Find the link search string S as a key for a database entry."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9572 (when (eq major-mode 'bibtex-mode)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9573 ;; Yes, we want to do the search in this file.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9574 ;; We construct a regexp that searches for "@entrytype{" followed by the key
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9575 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9576 (and (re-search-forward (concat "@[a-zA-Z]+[ \t\n]*{[ \t\n]*"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9577 (regexp-quote s) "[ \t\n]*,") nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9578 (goto-char (match-beginning 0)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9579 (if (and (match-beginning 0) (equal current-prefix-arg '(16)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9580 ;; Use double prefix to indicate that any web link should be browsed
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9581 (let ((b (current-buffer)) (p (point)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9582 ;; Restore the window configuration because we just use the web link
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9583 (set-window-configuration org-window-config-before-follow-link)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9584 (save-excursion (set-buffer b) (goto-char p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9585 (bibtex-url)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9586 (recenter 0)) ; Move entry start to beginning of window
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9587 ;; return t to indicate that the search is done.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9588 t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9589
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9590 ;; Finally add the functions to the right hooks.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9591 (add-hook 'org-create-file-search-functions 'org-create-file-search-in-bibtex)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9592 (add-hook 'org-execute-file-search-functions 'org-execute-file-search-in-bibtex)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9593
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9594 ;; end of Bibtex link setup
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9595
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9596 (defun org-upgrade-old-links (&optional query-description)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9597 "Transfer old <...> style links to new [[...]] style links.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9598 With arg query-description, ask at each match for a description text to use
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9599 for this link."
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9600 (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?")))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9601 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9602 (goto-char (point-min))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
9603 (let ((re (concat "\\([^[]\\)<\\("
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
9604 "\\(" (mapconcat 'identity org-link-types "\\|")
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9605 "\\):"
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9606 "[^" org-non-link-chars "]+\\)>"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9607 l1 l2 (cnt 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9608 (while (re-search-forward re nil t)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9609 (setq cnt (1+ cnt)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9610 l1 (org-match-string-no-properties 2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9611 l2 (save-match-data (org-link-escape l1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9612 (when query-description (setq l1 (read-string "Desc: " l1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9613 (if (equal l1 l2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9614 (replace-match (concat (match-string 1) "[[" l1 "]]") t t)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9615 (replace-match (concat (match-string 1) "[[" l2 "][" l1 "]]") t t)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9616 (message "%d matches have beed treated" cnt))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
9617
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9618 (defun org-open-file (path &optional in-emacs line search)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9619 "Open the file at PATH.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9620 First, this expands any special file name abbreviations. Then the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9621 configuration variable `org-file-apps' is checked if it contains an
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9622 entry for this file type, and if yes, the corresponding command is launched.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9623 If no application is found, Emacs simply visits the file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9624 With optional argument IN-EMACS, Emacs will visit the file.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9625 Optional LINE specifies a line to go to, optional SEARCH a string to
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9626 search for. If LINE or SEARCH is given, the file will always be
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9627 opened in Emacs.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9628 If the file does not exist, an error is thrown."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9629 (setq in-emacs (or in-emacs line search))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9630 (let* ((file (if (equal path "")
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9631 buffer-file-name
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9632 path))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9633 (apps (append org-file-apps (org-default-apps)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9634 (remp (and (assq 'remote apps) (org-file-remote-p file)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9635 (dirp (if remp nil (file-directory-p file)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9636 (dfile (downcase file))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9637 (old-buffer (current-buffer))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9638 (old-pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9639 (old-mode major-mode)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9640 ext cmd)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9641 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9642 (setq ext (match-string 1 dfile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9643 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9644 (setq ext (match-string 1 dfile))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9645 (if in-emacs
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9646 (setq cmd 'emacs)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9647 (setq cmd (or (and remp (cdr (assoc 'remote apps)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9648 (and dirp (cdr (assoc 'directory apps)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9649 (cdr (assoc ext apps))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9650 (cdr (assoc t apps)))))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9651 (when (eq cmd 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9652 (require 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9653 (mailcap-parse-mailcaps)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9654 (let* ((mime-type (mailcap-extension-to-mime (or ext "")))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9655 (command (mailcap-mime-info mime-type)))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9656 (if (stringp command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9657 (setq cmd command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9658 (setq cmd 'emacs))))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9659 (if (and (not (eq cmd 'emacs)) ; Emacs has not problems with non-ex files
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9660 (not (file-exists-p file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9661 (not org-open-non-existing-files))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9662 (error "No such file: %s" file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9663 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9664 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
9665 ;; Normalize use of quote, this can vary.
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
9666 (if (string-match "['\"]%s['\"]" cmd)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
9667 (setq cmd (replace-match "'%s'" t t cmd)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
9668 (setq cmd (format cmd file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9669 (save-window-excursion
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9670 (shell-command (concat cmd " &"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9671 ((or (stringp cmd)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9672 (eq cmd 'emacs))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9673 ; (unless (equal (file-truename file) (file-truename (or buffer-file-name "")))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9674 ; (funcall (cdr (assq 'file org-link-frame-setup)) file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9675 (funcall (cdr (assq 'file org-link-frame-setup)) file)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9676 (if line (goto-line line)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9677 (if search (org-link-search search))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9678 ((consp cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9679 (eval cmd))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9680 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
9681 (and (org-mode-p) (eq old-mode 'org-mode)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9682 (or (not (equal old-buffer (current-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9683 (not (equal old-pos (point))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9684 (org-mark-ring-push old-pos old-buffer))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9685
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9686 (defun org-default-apps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9687 "Return the default applications for this operating system."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9688 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9689 ((eq system-type 'darwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9690 org-file-apps-defaults-macosx)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9691 ((eq system-type 'windows-nt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9692 org-file-apps-defaults-windowsnt)
64078
ebf5ec3a071e (org-file-apps-defaults-gnu): Renamed from org-file-apps-defaults-linux.
Richard M. Stallman <rms@gnu.org>
parents: 64057
diff changeset
9693 (t org-file-apps-defaults-gnu)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9694
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9695 (defun org-expand-file-name (path)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9696 "Replace special path abbreviations and expand the file name."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9697 (expand-file-name path))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9698
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9699 (defun org-file-remote-p (file)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9700 "Test whether FILE specifies a location on a remote system.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9701 Return non-nil if the location is indeed remote.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9702
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9703 For example, the filename \"/user@host:/foo\" specifies a location
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9704 on the system \"/user@host:\"."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9705 (cond ((fboundp 'file-remote-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9706 (file-remote-p file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9707 ((fboundp 'tramp-handle-file-remote-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9708 (tramp-handle-file-remote-p file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9709 ((and (boundp 'ange-ftp-name-format)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9710 (string-match ange-ftp-name-format file))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9711 t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
9712 (t nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9713
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9714 (defvar org-insert-link-history nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9715 "Minibuffer history for links inserted with `org-insert-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9716
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9717 (defvar org-stored-links nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9718 "Contains the links stored with `org-store-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9719
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9720 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9721 (defun org-store-link (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9722 "\\<org-mode-map>Store an org-link to the current location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9723 This link can later be inserted into an org-buffer with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9724 \\[org-insert-link].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9725 For some link types, a prefix arg is interpreted:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9726 For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9727 For file links, arg negates `org-context-in-file-links'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9728 (interactive "P")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9729 (let (link cpltxt desc description search txt (pos (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9730 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9731
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9732 ((eq major-mode 'bbdb-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9733 (setq cpltxt (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9734 "bbdb:"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9735 (or (bbdb-record-name (bbdb-current-record))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9736 (bbdb-record-company (bbdb-current-record))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9737 link (org-make-link cpltxt)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
9738
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9739 ((eq major-mode 'Info-mode)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
9740 (setq link (org-make-link "info:"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9741 (file-name-nondirectory Info-current-file)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9742 ":" Info-current-node))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9743 (setq cpltxt (concat (file-name-nondirectory Info-current-file)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9744 ":" Info-current-node)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9745
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9746 ((eq major-mode 'calendar-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9747 (let ((cd (calendar-cursor-to-date)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9748 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9749 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9750 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9751 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9752 (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9753 nil nil nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9754
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9755 ((or (eq major-mode 'vm-summary-mode)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9756 (eq major-mode 'vm-presentation-mode))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9757 (and (eq major-mode 'vm-presentation-mode) (vm-summarize))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9758 (vm-follow-summary-cursor)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9759 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9760 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9761 (let* ((message (car vm-message-pointer))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9762 (folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9763 (subject (vm-su-subject message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9764 (author (vm-su-full-name message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9765 (message-id (vm-su-message-id message)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9766 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9767 (setq folder (abbreviate-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9768 (if (string-match (concat "^" (regexp-quote vm-folder-directory))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9769 folder)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9770 (setq folder (replace-match "" t t folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9771 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9772 (setq link (org-make-link "vm:" folder "#" message-id)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9773
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9774 ((eq major-mode 'wl-summary-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9775 (let* ((msgnum (wl-summary-message-number))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9776 (message-id (elmo-message-field wl-summary-buffer-elmo-folder
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9777 msgnum 'message-id))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9778 (wl-message-entity (elmo-msgdb-overview-get-entity
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9779 msgnum (wl-summary-buffer-msgdb)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9780 (author (wl-summary-line-from)) ; FIXME: correct?
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9781 (subject "???")) ; FIXME:
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9782 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9783 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9784 (setq link (org-make-link "wl:" wl-summary-buffer-folder-name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9785 "#" message-id))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9786
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9787 ((or (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9788 (equal major-mode 'mh-show-mode))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9789 (let ((from-header (org-mhe-get-header "From:"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9790 (to-header (org-mhe-get-header "To:"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9791 (subject (org-mhe-get-header "Subject:")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9792 (setq cpltxt (concat from-header " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9793 (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9794 (org-remove-angle-brackets
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9795 (org-mhe-get-header "Message-Id:"))))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9796
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9797 ((eq major-mode 'rmail-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9798 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9799 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9800 (rmail-narrow-to-non-pruned-header)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9801 (let ((folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9802 (message-id (mail-fetch-field "message-id"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9803 (author (mail-fetch-field "from"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9804 (subject (mail-fetch-field "subject")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9805 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9806 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9807 (setq link (org-make-link "rmail:" folder "#" message-id))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9808
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9809 ((eq major-mode 'gnus-group-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9810 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9811 (gnus-group-group-name)) ; version
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9812 ((fboundp 'gnus-group-name)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9813 (gnus-group-name))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9814 (t "???"))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9815 (setq cpltxt (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9816 (if (org-xor arg org-usenet-links-prefer-google)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9817 "http://groups.google.com/groups?group="
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9818 "gnus:")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9819 group)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9820 link (org-make-link cpltxt))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9821
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9822 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9823 (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9824 (gnus-summary-beginning-of-article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9825 (let* ((group (car gnus-article-current))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9826 (article (cdr gnus-article-current))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9827 (header (gnus-summary-article-header article))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9828 (author (mail-header-from header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9829 (message-id (mail-header-id header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9830 (date (mail-header-date header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9831 (subject (gnus-summary-subject-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9832 (setq cpltxt (concat author " on: " subject))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9833 (if (org-xor arg org-usenet-links-prefer-google)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9834 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9835 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9836 cpltxt "\n "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9837 (format "http://groups.google.com/groups?as_umsgid=%s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9838 (org-fixup-message-id-for-http message-id))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9839 (setq link (org-make-link "gnus:" group
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9840 "#" (number-to-string article))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9841
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9842 ((eq major-mode 'w3-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9843 (setq cpltxt (url-view-url t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9844 link (org-make-link cpltxt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9845 ((eq major-mode 'w3m-mode)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9846 (setq cpltxt (or w3m-current-title w3m-current-url)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9847 link (org-make-link w3m-current-url)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9848
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9849 ((setq search (run-hook-with-args-until-success
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9850 'org-create-file-search-functions))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9851 (setq link (concat "file:" (abbreviate-file-name buffer-file-name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9852 "::" search))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
9853 (setq cpltxt (or description link)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9854
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9855 ((eq major-mode 'image-mode)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9856 (setq cpltxt (concat "file:"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9857 (abbreviate-file-name buffer-file-name))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9858 link (org-make-link cpltxt)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
9859
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
9860 ((org-mode-p)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9861 ;; Just link to current headline
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9862 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9863 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9864 ;; Add a context search string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9865 (when (org-xor org-context-in-file-links arg)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9866 ;; Check if we are on a target
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9867 (if (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9868 (skip-chars-forward "^>\n\r")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9869 (and (re-search-backward "<<" nil t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9870 (looking-at "<<\\(.*?\\)>>")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9871 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9872 (>= (match-end 0) pos)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9873 (setq cpltxt (concat cpltxt "::" (match-string 1)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9874 (setq txt (cond
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9875 ((org-on-heading-p) nil)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9876 ((org-region-active-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9877 (buffer-substring (region-beginning) (region-end)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9878 (t (buffer-substring (point-at-bol) (point-at-eol)))))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
9879 (when (or (null txt) (string-match "\\S-" txt))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9880 (setq cpltxt
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9881 (concat cpltxt "::"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9882 (if org-file-link-context-use-camel-case
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9883 (org-make-org-heading-camel txt)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9884 (org-make-org-heading-search-string txt)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9885 desc "NONE"))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9886 (if (string-match "::\\'" cpltxt)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9887 (setq cpltxt (substring cpltxt 0 -2)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9888 (setq link (org-make-link cpltxt)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9889
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9890 (buffer-file-name
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9891 ;; Just link to this file here.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9892 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
9893 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9894 ;; Add a context string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9895 (when (org-xor org-context-in-file-links arg)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9896 (setq txt (if (org-region-active-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9897 (buffer-substring (region-beginning) (region-end))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9898 (buffer-substring (point-at-bol) (point-at-eol))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9899 ;; Only use search option if there is some text.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9900 (when (string-match "\\S-" txt)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9901 (setq cpltxt
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9902 (concat cpltxt "::"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9903 (if org-file-link-context-use-camel-case
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9904 (org-make-org-heading-camel txt)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9905 (org-make-org-heading-search-string txt)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
9906 desc "NONE")))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9907 (setq link (org-make-link cpltxt)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9908
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9909 ((interactive-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9910 (error "Cannot link to a buffer which is not visiting a file"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9911
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9912 (t (setq link nil)))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9913
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9914 (if (consp link) (setq cpltxt (car link) link (cdr link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9915 (setq link (or link cpltxt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9916 desc (or desc cpltxt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9917 (if (equal desc "NONE") (setq desc nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9918
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9919 (if (and (interactive-p) link)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9920 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9921 (setq org-stored-links
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9922 (cons (list cpltxt link desc) org-stored-links))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9923 (message "Stored: %s" (or cpltxt link)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9924 (org-make-link-string link desc))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9925
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9926 (defun org-make-org-heading-search-string (&optional string heading)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9927 "Make search string for STRING or current headline."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9928 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9929 (let ((s (or string (org-get-heading))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9930 (unless (and string (not heading))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9931 ;; We are using a headline, clean up garbage in there.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9932 (if (string-match org-todo-regexp s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9933 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9934 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9935 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9936 (setq s (org-trim s))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9937 (if (string-match (concat "^\\(" org-quote-string "\\|"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9938 org-comment-string "\\)") s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9939 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9940 (while (string-match org-ts-regexp s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9941 (setq s (replace-match "" t t s))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9942 (while (string-match "[^a-zA-Z_0-9 \t]+" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9943 (setq s (replace-match " " t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9944 (or string (setq s (concat "*" s))) ; Add * for headlines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9945 (mapconcat 'identity (org-split-string s "[ \t]+") " ")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9946
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9947 (defun org-make-org-heading-camel (&optional string heading)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9948 "Make a CamelCase string for STRING or the current headline."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9949 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9950 (let ((s (or string (org-get-heading))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9951 (unless (and string (not heading))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9952 ;; We are using a headline, clean up garbage in there.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9953 (if (string-match org-todo-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9954 (setq s (replace-match "" t t s)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9955 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
9956 (setq s (replace-match "" t t s)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9957 (setq s (org-trim s))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9958 (if (string-match (concat "^\\(" org-quote-string "\\|"
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9959 org-comment-string "\\)") s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9960 (setq s (replace-match "" t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9961 (while (string-match org-ts-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9962 (setq s (replace-match "" t t s))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9963 (while (string-match "[^a-zA-Z_ \t]+" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9964 (setq s (replace-match " " t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9965 (or string (setq s (concat "*" s))) ; Add * for headlines
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9966 (mapconcat 'capitalize (org-split-string s "[ \t]+") "")))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
9967
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9968 (defun org-make-link (&rest strings)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9969 "Concatenate STRINGS, format resulting string with `org-link-format'."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9970 (format org-link-format (apply 'concat strings)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9971
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9972 (defun org-make-link-string (link &optional description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9973 "Make a link with brackets, consisting of LINK and DESCRIPTION."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9974 (if (eq org-link-style 'plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9975 (if (equal description link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9976 link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9977 (concat description "\n" link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9978 (when (stringp description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9979 ;; Remove brackets from the description, they are fatal.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9980 (while (string-match "\\[\\|\\]" description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9981 (setq description (replace-match "" t t description))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9982 (when (equal (org-link-escape link) description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9983 ;; No description needed, it is identical
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9984 (setq description nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9985 (when (and (not description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9986 (not (equal link (org-link-escape link))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9987 (setq description link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9988 (concat "[[" (org-link-escape link) "]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9989 (if description (concat "[" description "]") "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9990 "]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9991
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9992 (defconst org-link-escape-chars '(("[" . "%5B") ("]" . "%5D") (" " . "%20"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9993 "Association list of escapes for some characters problematic in links.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9994
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9995 (defun org-link-escape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9996 "Escape charaters in TEXT that are problematic for links."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9997 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9998 (let ((re (mapconcat (lambda (x) (regexp-quote (car x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9999 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10000 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10001 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10002 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10003 (cdr (assoc (match-string 0 text) org-link-escape-chars))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10004 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10005 text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10006
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10007 (defun org-link-unescape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10008 "Reverse the action of `org-link-escape'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10009 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10010 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10011 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10012 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10013 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10014 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10015 (car (rassoc (match-string 0 text) org-link-escape-chars))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10016 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10017 text)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10018
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10019 (defun org-xor (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10020 "Exclusive or."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
10021 (if a (not b) b))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10022
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10023 (defun org-get-header (header)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10024 "Find a header field in the current buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10025 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10026 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10027 (let ((case-fold-search t) s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10028 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10029 ((eq header 'from)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10030 (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10031 (setq s (match-string 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10032 (while (string-match "\"" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10033 (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10034 (if (string-match "[<(].*" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10035 (setq s (replace-match "" t t s))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10036 ((eq header 'message-id)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10037 (if (re-search-forward "^message-id:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10038 (setq s (match-string 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10039 ((eq header 'subject)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10040 (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10041 (setq s (match-string 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10042 (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10043 (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10044 s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10045
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10046
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10047 (defun org-fixup-message-id-for-http (s)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10048 "Replace special characters in a message id, so it can be used in an http query."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10049 (while (string-match "<" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10050 (setq s (replace-match "%3C" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10051 (while (string-match ">" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10052 (setq s (replace-match "%3E" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10053 (while (string-match "@" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10054 (setq s (replace-match "%40" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10055 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10056
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10057 (defun org-insert-link (&optional complete-file)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
10058 "Insert a link. At the prompt, enter the link.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10059
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10060 Completion can be used to select a link previously stored with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10061 `org-store-link'. When the empty string is entered (i.e. if you just
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10062 press RET at the prompt), the link defaults to the most recently
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10063 stored link. As SPC triggers completion in the minibuffer, you need to
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10064 use M-SPC or C-q SPC to force the insertion of a space character.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10065
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10066 You will also be prompted for a description, and if one is given, it will
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10067 be displayed in the buffer instead of the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10068
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10069 If there is already a link at point, this command will allow you to edit link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10070 and description parts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10071
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10072 With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10073 selected using completion. The path to the file will be relative to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10074 the current directory if the file is in the current directory or a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10075 subdirectory. Otherwise, the link will be the absolute path as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10076 completed in the minibuffer (i.e. normally ~/path/to/file).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10077
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10078 With two \\[universal-argument] prefixes, enforce an absolute path even if the file
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10079 is in the current directory or below.
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10080 With three \\[universal-argument] prefixes, negate the meaning of
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10081 `org-keep-stored-link-after-insertion'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10082 (interactive "P")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10083 (let (link desc entry remove file (pos (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10084 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10085 ((save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10086 (skip-chars-forward "^]\n\r")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10087 (and (re-search-backward "\\[\\[" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10088 (looking-at org-bracket-link-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10089 (<= (match-beginning 0) pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10090 (>= (match-end 0) pos)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10091 ;; We do have a link at point, and we are going to edit it.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10092 (setq remove (list (match-beginning 0) (match-end 0)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10093 (setq desc (if (match-end 3) (org-match-string-no-properties 3)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
10094 (setq link (read-string "Link: "
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
10095 (org-link-unescape
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10096 (org-match-string-no-properties 1)))))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10097 ((equal complete-file '(4))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10098 ;; Completing read for file names.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10099 (setq file (read-file-name "File: "))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
10100 (let ((pwd (file-name-as-directory (expand-file-name ".")))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
10101 (pwd1 (file-name-as-directory (abbreviate-file-name
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
10102 (expand-file-name ".")))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10103 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10104 ((equal complete-file '(16))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10105 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10106 "file:"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10107 (abbreviate-file-name (expand-file-name file)))))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
10108 ((string-match (concat "^" (regexp-quote pwd1) "\\(.+\\)") file)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
10109 (setq link (org-make-link "file:" (match-string 1 file))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10110 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10111 (expand-file-name file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10112 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10113 "file:" (match-string 1 (expand-file-name file)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10114 (t (setq link (org-make-link "file:" file))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10115 (t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10116 ;; Read link, with completion for stored links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10117 (setq link (org-completing-read
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10118 "Link: " org-stored-links nil nil nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10119 org-insert-link-history
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10120 (or (car (car org-stored-links)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10121 (setq entry (assoc link org-stored-links))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10122 (if (funcall (if (equal complete-file '(64)) 'not 'identity)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
10123 (not org-keep-stored-link-after-insertion))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10124 (setq org-stored-links (delq (assoc link org-stored-links)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10125 org-stored-links)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10126 (setq link (if entry (nth 1 entry) link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10127 desc (or desc (nth 2 entry)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10128
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10129 (if (string-match org-plain-link-re link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10130 ;; URL-like link, normalize the use of angular brackets.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10131 (setq link (org-make-link (org-remove-angle-brackets link))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10132
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10133 ;; Check if we are linking to the current file with a search option
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10134 ;; If yes, simplify the link by using only the search option.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10135 (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10136 (let* ((path (match-string 1 link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10137 (case-fold-search nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10138 (search (match-string 2 link)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10139 (save-match-data
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10140 (if (equal (file-truename buffer-file-name) (file-truename path))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10141 ;; We are linking to this same file, with a search option
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10142 (setq link search)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10143
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10144 ;; Check if we can/should use a relative path. If yes, simplify the link
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10145 (when (string-match "\\<file:\\(.*\\)" link)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10146 (let* ((path (match-string 1 link))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10147 (case-fold-search nil))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10148 (cond
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10149 ((eq org-link-file-path-type 'absolute)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10150 (setq path (abbreviate-file-name (expand-file-name path))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10151 ((eq org-link-file-path-type 'noabbrev)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10152 (setq path (expand-file-name path)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10153 ((eq org-link-file-path-type 'relative)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10154 (setq path (file-relative-name path)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10155 (t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10156 (save-match-data
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
10157 (if (string-match (concat "^" (regexp-quote
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10158 (file-name-as-directory
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10159 (expand-file-name "."))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10160 (expand-file-name path))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10161 ;; We are linking a file with relative path name.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10162 (setq path (substring (expand-file-name path)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10163 (match-end 0)))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10164 (setq link (concat "file:" path))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10165
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10166 (setq desc (read-string "Description: " desc))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10167 (unless (string-match "\\S-" desc) (setq desc nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10168 (if remove (apply 'delete-region remove))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10169 (insert (org-make-link-string link desc))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10170
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10171 (defun org-completing-read (&rest args)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
10172 (let ((minibuffer-local-completion-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10173 (copy-keymap minibuffer-local-completion-map)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10174 (define-key minibuffer-local-completion-map " " 'self-insert-command)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10175 (apply 'completing-read args)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10176
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10177 ;;; Hooks for remember.el
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10178
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10179 (defvar org-finish-function nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10180
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10181 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10182 (defun org-remember-annotation ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10183 "Return a link to the current location as an annotation for remember.el.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10184 If you are using Org-mode files as target for data storage with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10185 remember.el, then the annotations should include a link compatible with the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10186 conventions in Org-mode. This function returns such a link."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10187 (org-store-link nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10188
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10189 (defconst org-remember-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10190 "Select a destination location for the note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10191 UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10192 RET at beg-of-buf -> Append to file as level 2 headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10193 RET on headline -> Store as sublevel entry to current headline
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10194 <left>/<right> -> before/after current headline, same headings level")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10195
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10196 ;;;###autoload
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10197 (defun org-remember-apply-template ()
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10198 "Initialize *remember* buffer with template, invoke `org-mode'.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10199 This function should be placed into `remember-mode-hook' and in fact requires
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10200 to be run from that hook to fucntion properly."
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10201 (if org-remember-templates
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10202
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10203 (let* ((entry (if (= (length org-remember-templates) 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10204 (cdar org-remember-templates)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10205 (message "Select template: %s"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10206 (mapconcat
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10207 (lambda (x) (char-to-string (car x)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10208 org-remember-templates " "))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10209 (cdr (assoc (read-char-exclusive) org-remember-templates))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10210 (tpl (car entry))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10211 (file (if (consp (cdr entry)) (nth 1 entry)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10212 (v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10213 (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10214 (v-u (concat "[" (substring v-t 1 -1) "]"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10215 (v-U (concat "[" (substring v-T 1 -1) "]"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10216 (v-a annotation) ; defined in `remember-mode'
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10217 (v-i initial) ; defined in `remember-mode'
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10218 (v-n user-full-name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10219 )
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10220 (unless tpl (setq tpl "") (message "No template") (ding))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10221 (insert tpl) (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10222 (while (re-search-forward "%\\([tTuTai]\\)" nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10223 (when (and initial (equal (match-string 0) "%i"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10224 (save-match-data
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10225 (let* ((lead (buffer-substring
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10226 (point-at-bol) (match-beginning 0))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10227 (setq v-i (mapconcat 'identity
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10228 (org-split-string initial "\n")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10229 (concat "\n" lead))))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10230 (replace-match
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10231 (or (eval (intern (concat "v-" (match-string 1)))) "")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10232 t t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10233 (let ((org-startup-folded nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10234 (org-startup-with-deadline-check nil))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10235 (org-mode))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10236 (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10237 (set (make-local-variable 'org-default-notes-file) file))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10238 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10239 (if (re-search-forward "%\\?" nil t) (replace-match "")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10240 (let ((org-startup-folded nil)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10241 (org-startup-with-deadline-check nil))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10242 (org-mode)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10243 (set (make-local-variable 'org-finish-function) 'remember-buffer))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10244
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10245 ;;;###autoload
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10246 (defun org-remember-handler ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10247 "Store stuff from remember.el into an org file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10248 First prompts for an org file. If the user just presses return, the value
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10249 of `org-default-notes-file' is used.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10250 Then the command offers the headings tree of the selected file in order to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10251 file the text at a specific location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10252 You can either immediately press RET to get the note appended to the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10253 file, or you can use vertical cursor motion and visibility cycling (TAB) to
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10254 find a better place. Then press RET or <left> or <right> in insert the note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10255
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10256 Key Cursor position Note gets inserted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10257 -----------------------------------------------------------------------------
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10258 RET buffer-start as level 2 heading at end of file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10259 RET on headline as sublevel of the heading at cursor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10260 RET no heading at cursor position, level taken from context.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10261 Or use prefix arg to specify level manually.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10262 <left> on headline as same level, before current heading
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10263 <right> on headline as same level, after current heading
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10264
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10265 So the fastest way to store the note is to press RET RET to append it to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10266 the default file. This way your current train of thought is not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10267 interrupted, in accordance with the principles of remember.el. But with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10268 little extra effort, you can push it directly to the correct location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10269
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10270 Before being stored away, the function ensures that the text has a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10271 headline, i.e. a first line that starts with a \"*\". If not, a headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10272 is constructed from the current date and some additional data.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10273
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10274 If the variable `org-adapt-indentation' is non-nil, the entire text is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10275 also indented so that it starts in the same column as the headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10276 \(i.e. after the stars).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10277
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10278 See also the variable `org-reverse-note-order'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10279 (catch 'quit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10280 (let* ((txt (buffer-substring (point-min) (point-max)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10281 (fastp current-prefix-arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10282 (file (if fastp org-default-notes-file (org-get-org-file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10283 (visiting (find-buffer-visiting file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10284 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10285 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10286 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10287 spos level indent reversed)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10288 ;; Modify text so that it becomes a nice subtree which can be inserted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10289 ;; into an org tree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10290 (let* ((lines (split-string txt "\n"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10291 first)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10292 ;; remove empty lines at the beginning
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10293 (while (and lines (string-match "^[ \t]*\n" (car lines)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10294 (setq lines (cdr lines)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10295 (setq first (car lines) lines (cdr lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10296 (if (string-match "^\\*+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10297 ;; Is already a headline
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10298 (setq indent nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10299 ;; We need to add a headline: Use time and first buffer line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10300 (setq lines (cons first lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10301 first (concat "* " (current-time-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10302 " (" (remember-buffer-desc) ")")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10303 indent " "))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10304 (if (and org-adapt-indentation indent)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10305 (setq lines (mapcar (lambda (x) (concat indent x)) lines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10306 (setq txt (concat first "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10307 (mapconcat 'identity lines "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10308 ;; Find the file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10309 (if (not visiting)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10310 (find-file-noselect file))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10311 (with-current-buffer (get-file-buffer file)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10312 (save-excursion (and (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10313 (not (re-search-forward "^\\* " nil t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10314 (insert "\n* Notes\n")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10315 (setq reversed (org-notes-order-reversed-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10316 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10317 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10318 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10319 ;; Ask the User for a location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10320 (setq spos (if fastp 1 (org-get-location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10321 (current-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10322 org-remember-help)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10323 (if (not spos) (throw 'quit nil)) ; return nil to show we did
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10324 ; not handle this note
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10325 (goto-char spos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10326 (cond ((bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10327 ;; Put it at the start or end, as level 2
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10328 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10329 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10330 (goto-char (if reversed (point-min) (point-max)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10331 (if (not (bolp)) (newline))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10332 (org-paste-subtree 2 txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10333 ((and (org-on-heading-p nil) (not current-prefix-arg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10334 ;; Put it below this entry, at the beg/end of the subtree
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10335 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
10336 (setq level (funcall outline-level))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10337 (if reversed
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10338 (outline-end-of-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10339 (outline-end-of-subtree))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10340 (if (not (bolp)) (newline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10341 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10342 (org-paste-subtree (1+ level) txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10343 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10344 ;; Put it right there, with automatic level determined by
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10345 ;; org-paste-subtree or from prefix arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10346 (org-paste-subtree current-prefix-arg txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10347 (when remember-save-after-remembering
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10348 (save-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10349 (if (not visiting) (kill-buffer (current-buffer)))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10350 t) ;; return t to indicate that we took care of this note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10351
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10352 (defun org-get-org-file ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10353 "Read a filename, with default directory `org-directory'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10354 (let ((default (or org-default-notes-file remember-data-file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10355 (read-file-name (format "File name [%s]: " default)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10356 (file-name-as-directory org-directory)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10357 default)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10358
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10359 (defun org-notes-order-reversed-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10360 "Check if the current file should receive notes in reversed order."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10361 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10362 ((not org-reverse-note-order) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10363 ((eq t org-reverse-note-order) t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10364 ((not (listp org-reverse-note-order)) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10365 (t (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10366 (let ((all org-reverse-note-order)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10367 entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10368 (while (setq entry (pop all))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
10369 (if (string-match (car entry) buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10370 (throw 'exit (cdr entry))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10371 nil)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10372
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10373 ;;; Tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10374
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10375 ;; Watch out: Here we are talking about two different kind of tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10376 ;; Most of the code is for the tables created with the Org-mode table editor.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10377 ;; Sometimes, we talk about tables created and edited with the table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10378 ;; Emacs package. We call the former org-type tables, and the latter
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10379 ;; table.el-type tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10380
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10381
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10382 (defun org-before-change-function (beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10383 "Every change indicates that a table might need an update."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10384 (setq org-table-may-need-update t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10385
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10386 (defconst org-table-line-regexp "^[ \t]*|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10387 "Detects an org-type table line.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10388 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10389 "Detects an org-type table line.")
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10390 (defconst org-table-auto-recalculate-regexp "^[ \t]*| *# *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10391 "Detects a table line marked for automatic recalculation.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10392 (defconst org-table-recalculate-regexp "^[ \t]*| *[#*] *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10393 "Detects a table line marked for automatic recalculation.")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10394 (defconst org-table-calculate-mark-regexp "^[ \t]*| *[!$^_#*] *\\(|\\|$\\)"
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10395 "Detects a table line marked for automatic recalculation.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10396 (defconst org-table-hline-regexp "^[ \t]*|-"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10397 "Detects an org-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10398 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10399 "Detects a table-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10400 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10401 "Detects an org-type or table-type table.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10402 (defconst org-table-border-regexp "^[ \t]*[^| \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10403 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10404 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10405 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10406 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10407 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10408
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10409 (defun org-table-create-with-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10410 "Use the table.el package to insert a new table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10411 If there is already a table at point, convert between Org-mode tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10412 and table.el tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10413 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10414 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10415 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10416 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10417 (if (y-or-n-p "Convert table to Org-mode table? ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10418 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10419 ((org-at-table-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10420 (if (y-or-n-p "Convert table to table.el table? ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10421 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10422 (t (call-interactively 'table-insert))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10423
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10424 (defun org-table-create-or-convert-from-region (arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10425 "Convert region to table, or create an empty table.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10426 If there is an active region, convert it to a table. If there is no such
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10427 region, create an empty table."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10428 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10429 (if (org-region-active-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10430 (org-table-convert-region (region-beginning) (region-end) arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10431 (org-table-create arg)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10432
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10433 (defun org-table-create (&optional size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10434 "Query for a size and insert a table skeleton.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10435 SIZE is a string Columns x Rows like for example \"3x2\"."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10436 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10437 (unless size
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10438 (setq size (read-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10439 (concat "Table size Columns x Rows [e.g. "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10440 org-table-default-size "]: ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10441 "" nil org-table-default-size)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10442
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10443 (let* ((pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10444 (indent (make-string (current-column) ?\ ))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10445 (split (org-split-string size " *x *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10446 (rows (string-to-number (nth 1 split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10447 (columns (string-to-number (car split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10448 (line (concat (apply 'concat indent "|" (make-list columns " |"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10449 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10450 (if (string-match "^[ \t]*$" (buffer-substring-no-properties
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10451 (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10452 (beginning-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10453 (newline))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
10454 ;; (mapcar (lambda (x) (insert line)) (make-list rows t))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
10455 (dotimes (i rows) (insert line))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10456 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10457 (if (> rows 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10458 ;; Insert a hline after the first row.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10459 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10460 (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10461 (insert "\n|-")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10462 (goto-char pos)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10463 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10464
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10465 (defun org-table-convert-region (beg0 end0 &optional nspace)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10466 "Convert region to a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10467 The region goes from BEG0 to END0, but these borders will be moved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10468 slightly, to make sure a beginning of line in the first line is included.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10469 When NSPACE is non-nil, it indicates the minimum number of spaces that
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10470 separate columns (default: just one space)."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10471 (interactive "rP")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10472 (let* ((beg (min beg0 end0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10473 (end (max beg0 end0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10474 (tabsep t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10475 re)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10476 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10477 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10478 (setq beg (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10479 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10480 (if (bolp) (backward-char 1) (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10481 (setq end (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10482 ;; Lets see if this is tab-separated material. If every nonempty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10483 ;; contains a tab, we will assume that it is tab-separated material
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10484 (if nspace
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10485 (setq tabsep nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10486 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10487 (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10488 (if nspace (setq tabsep nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10489 (if tabsep
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10490 (setq re "^\\|\t")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10491 (setq re (format "^ *\\| *\t *\\| \\{%d,\\}"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10492 (max 1 (prefix-numeric-value nspace)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10493 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10494 (while (re-search-forward re end t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10495 (replace-match "|" t t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10496 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10497 (insert " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10498 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10499
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10500 (defun org-table-import (file arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10501 "Import FILE as a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10502 The file is assumed to be tab-separated. Such files can be produced by most
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10503 spreadsheet and database applications. If no tabs (at least one per line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10504 are found, lines will be split on whitespace into fields."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10505 (interactive "f\nP")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10506 (or (bolp) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10507 (let ((beg (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10508 (pm (point-max)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10509 (insert-file-contents file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10510 (org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10511
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10512 (defun org-table-export ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10513 "Export table as a tab-separated file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10514 Such a file can be imported into a spreadsheet program like Excel."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10515 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10516 (let* ((beg (org-table-begin))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10517 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10518 (table (buffer-substring beg end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10519 (file (read-file-name "Export table to: "))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10520 buf)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10521 (unless (or (not (file-exists-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10522 (y-or-n-p (format "Overwrite file %s? " file)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10523 (error "Abort"))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
10524 (with-current-buffer (find-file-noselect file)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10525 (setq buf (current-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10526 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10527 (fundamental-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10528 (insert table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10529 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10530 (while (re-search-forward "^[ \t]*|[ \t]*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10531 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10532 (end-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10533 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10534 (while (re-search-forward "[ \t]*|[ \t]*$" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10535 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10536 (goto-char (min (1+ (point)) (point-max))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10537 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10538 (while (re-search-forward "^-[-+]*$" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10539 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10540 (if (looking-at "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10541 (delete-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10542 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10543 (while (re-search-forward "[ \t]*|[ \t]*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10544 (replace-match "\t" t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10545 (save-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10546 (kill-buffer buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10547
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10548 (defvar org-table-aligned-begin-marker (make-marker)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10549 "Marker at the beginning of the table last aligned.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10550 Used to check if cursor still is in that table, to minimize realignment.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10551 (defvar org-table-aligned-end-marker (make-marker)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10552 "Marker at the end of the table last aligned.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10553 Used to check if cursor still is in that table, to minimize realignment.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10554 (defvar org-table-last-alignment nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
10555 "List of flags for flushright alignment, from the last re-alignment.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10556 This is being used to correctly align a single field after TAB or RET.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10557 (defvar org-table-last-column-widths nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
10558 "List of max width of fields in each column.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10559 This is being used to correctly align a single field after TAB or RET.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10560
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10561 (defvar org-last-recalc-line nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10562 (defconst org-narrow-column-arrow "=>"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10563 "Used as display property in narrowed table columns.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10564
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10565 (defun org-table-align ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10566 "Align the table at point by aligning all vertical bars."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10567 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10568 (let* (
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10569 ;; Limits of table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10570 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10571 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10572 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10573 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10574 (colpos (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10575 (winstart (window-start))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
10576 lines (new "") lengths l typenums ty fields maxfields i
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10577 column
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10578 (indent "") cnt frac
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10579 rfmt hfmt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10580 (spaces '(1 . 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10581 (sp1 (car spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10582 (sp2 (cdr spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10583 (rfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10584 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10585 (hfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10586 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
10587 emptystrings links narrow fmax f1 len c e)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10588 (untabify beg end)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10589 (remove-text-properties beg end '(org-cwidth t display t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10590 ;; Check if we have links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10591 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10592 (setq links (re-search-forward org-bracket-link-regexp end t))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
10593 ;; Make sure the link properties are right
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10594 (when links (goto-char beg) (while (org-activate-bracket-links end)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10595 ;; Check if we are narrowing any columns
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10596 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10597 (setq narrow (and org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10598 (re-search-forward "<[0-9]+>" end t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10599 ;; Get the rows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10600 (setq lines (org-split-string
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10601 (buffer-substring beg end) "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10602 ;; Store the indentation of the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10603 (if (string-match "^ *" (car lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10604 (setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10605 ;; Mark the hlines by setting the corresponding element to nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10606 ;; At the same time, we remove trailing space.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10607 (setq lines (mapcar (lambda (l)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10608 (if (string-match "^ *|-" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10609 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10610 (if (string-match "[ \t]+$" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10611 (substring l 0 (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10612 l)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10613 lines))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10614 ;; Get the data fields by splitting the lines.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10615 (setq fields (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10616 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10617 (org-split-string l " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10618 (delq nil (copy-sequence lines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10619 ;; How many fields in the longest line?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10620 (condition-case nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10621 (setq maxfields (apply 'max (mapcar 'length fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10622 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10623 (kill-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10624 (org-table-create org-table-default-size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10625 (error "Empty table - created default table")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10626 ;; A list of empty string to fill any short rows on output
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10627 (setq emptystrings (make-list maxfields ""))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10628 ;; Check for special formatting.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10629 (setq i -1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10630 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10631 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10632 ;; Check if there is an explicit width specified
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10633 (when (and org-table-limit-column-width narrow)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10634 (setq c column fmax nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10635 (while c
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10636 (setq e (pop c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10637 (if (and (stringp e) (string-match "^<\\([0-9]+\\)>$" e))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10638 (setq fmax (string-to-number (match-string 1 e)) c nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10639 ;; Find fields that are wider than fmax, and shorten them
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10640 (when fmax
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10641 (loop for xx in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10642 (when (and (stringp xx)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10643 (> (org-string-width xx) fmax))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10644 (org-add-props xx nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10645 'help-echo
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
10646 (concat "Clipped table field, use C-c ` to edit. Full value is:\n" (org-no-properties (copy-sequence xx))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10647 (setq f1 (min fmax (or (string-match org-bracket-link-regexp xx) fmax)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10648 (unless (> f1 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10649 (error "Cannot narrow field starting with wide link \"%s\""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10650 (match-string 0 xx)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10651 (add-text-properties f1 (length xx) (list 'org-cwidth t) xx)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
10652 (add-text-properties (- f1 2) f1
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10653 (list 'display org-narrow-column-arrow)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10654 xx)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10655 ;; Get the maximum width for each column
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10656 (push (apply 'max 1 (mapcar 'org-string-width column)) lengths)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10657 ;; Get the fraction of numbers, to decide about alignment of the column
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10658 (setq cnt 0 frac 0.0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10659 (loop for x in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10660 (if (equal x "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10661 nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10662 (setq frac ( / (+ (* frac cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10663 (if (string-match org-table-number-regexp x) 1 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10664 (setq cnt (1+ cnt))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10665 (push (>= frac org-table-number-fraction) typenums))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10666 (setq lengths (nreverse lengths) typenums (nreverse typenums))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10667
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10668 ;; Store the alignment of this table, for later editing of single fields
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10669 (setq org-table-last-alignment typenums
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10670 org-table-last-column-widths lengths)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10671
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10672 ;; With invisible characters, `format' does not get the field width right
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10673 ;; So we need to make these fields wide by hand.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10674 (when links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10675 (loop for i from 0 upto (1- maxfields) do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10676 (setq len (nth i lengths))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10677 (loop for j from 0 upto (1- (length fields)) do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10678 (setq c (nthcdr i (car (nthcdr j fields))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10679 (if (and (stringp (car c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10680 (string-match org-bracket-link-regexp (car c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10681 (< (org-string-width (car c)) len))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10682 (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ )))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10683
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10684 ;; Compute the formats needed for output of the table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10685 (setq rfmt (concat indent "|") hfmt (concat indent "|"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10686 (while (setq l (pop lengths))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10687 (setq ty (if (pop typenums) "" "-")) ; number types flushright
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10688 (setq rfmt (concat rfmt (format rfmt1 ty l))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10689 hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10690 (setq rfmt (concat rfmt "\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10691 hfmt (concat (substring hfmt 0 -1) "|\n"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10692
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
10693 (setq new (mapconcat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10694 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10695 (if l (apply 'format rfmt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10696 (append (pop fields) emptystrings))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10697 hfmt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10698 lines ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10699 ;; Replace the old one
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10700 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10701 (move-marker end nil)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10702 (move-marker org-table-aligned-begin-marker (point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10703 (insert new)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10704 (move-marker org-table-aligned-end-marker (point))
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
10705 (when (and orgtbl-mode (not (org-mode-p)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10706 (goto-char org-table-aligned-begin-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10707 (while (org-hide-wide-columns org-table-aligned-end-marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10708 ;; Try to move to the old location (approximately)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10709 (goto-line linepos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10710 (set-window-start (selected-window) winstart 'noforce)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10711 (org-table-goto-column colpos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10712 (setq org-table-may-need-update nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10713 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10714
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10715 (defun org-string-width (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10716 "Compute width of string, ignoring invisible characters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10717 This ignores character with invisibility property `org-link', and also
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10718 characters with property `org-cwidth', because these will become invisible
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10719 upon the next fontification round."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10720 (let (b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10721 (when (or (eq t buffer-invisibility-spec)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10722 (assq 'org-link buffer-invisibility-spec))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10723 (while (setq b (text-property-any 0 (length s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10724 'invisible 'org-link s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10725 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10726 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10727 b 'invisible s) (length s)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10728 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10729 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10730 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10731 b 'org-cwidth s) (length s))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10732 (string-width s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10733
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10734 (defun org-table-begin (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10735 "Find the beginning of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10736 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10737 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10738 (if (not (re-search-backward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10739 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10740 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10741 nil t))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
10742 (progn (goto-char (point-min)) (point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10743 (goto-char (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10744 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10745 (point))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10746
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10747 (defun org-table-end (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10748 "Find the end of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10749 With argument TABLE-TYPE, go to the end of a table.el-type table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10750 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10751 (if (not (re-search-forward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10752 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10753 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10754 nil t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10755 (goto-char (point-max))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10756 (goto-char (match-beginning 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10757 (point-marker)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10758
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10759 (defun org-table-justify-field-maybe (&optional new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10760 "Justify the current field, text to left, number to right.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10761 Optional argument NEW may specify text to replace the current field content."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10762 (cond
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10763 ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10764 ((org-at-table-hline-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10765 ((and (not new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10766 (or (not (equal (marker-buffer org-table-aligned-begin-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10767 (current-buffer)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10768 (< (point) org-table-aligned-begin-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10769 (>= (point) org-table-aligned-end-marker)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10770 ;; This is not the same table, force a full re-align
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10771 (setq org-table-may-need-update t))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10772 (t ;; realign the current field, based on previous full realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10773 (let* ((pos (point)) s
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10774 (col (org-table-current-column))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10775 (num (if (> col 0) (nth (1- col) org-table-last-alignment)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10776 l f n o e)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10777 (when (> col 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10778 (skip-chars-backward "^|\n")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10779 (if (looking-at " *\\([^|\n]*?\\) *\\(|\\|$\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10780 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10781 (setq s (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10782 o (match-string 0)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10783 l (max 1 (- (match-end 0) (match-beginning 0) 3))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10784 e (not (= (match-beginning 2) (match-end 2))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10785 (setq f (format (if num " %%%ds %s" " %%-%ds %s")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10786 l (if e "|" (setq org-table-may-need-update t) ""))
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
10787 n (format f s))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10788 (if new
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
10789 (if (<= (length new) l) ;; FIXME: length -> str-width?
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
10790 (setq n (format f new))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10791 (setq n (concat new "|") org-table-may-need-update t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10792 (or (equal n o)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10793 (let (org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10794 (replace-match n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10795 (setq org-table-may-need-update t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10796 (goto-char pos))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10797
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10798 (defun org-table-next-field ()
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10799 "Go to the next field in the current table, creating new lines as needed.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10800 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10801 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10802 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10803 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10804 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10805 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10806 (org-table-align))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10807 (let ((end (org-table-end)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10808 (if (org-at-table-hline-p)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10809 (end-of-line 1))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10810 (condition-case nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10811 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10812 (re-search-forward "|" end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10813 (if (looking-at "[ \t]*$")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10814 (re-search-forward "|" end))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10815 (if (and (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10816 org-table-tab-jumps-over-hlines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10817 (re-search-forward "^[ \t]*|\\([^-]\\)" end t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10818 (goto-char (match-beginning 1)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10819 (if (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10820 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10821 (beginning-of-line 0)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10822 (org-table-insert-row 'below))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10823 (if (looking-at " ") (forward-char 1))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10824 (error
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10825 (org-table-insert-row 'below)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10826
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10827 (defun org-table-previous-field ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10828 "Go to the previous field in the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10829 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10830 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10831 (org-table-justify-field-maybe)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10832 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10833 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10834 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10835 (org-table-align))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10836 (if (org-at-table-hline-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10837 (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10838 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10839 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10840 (while (looking-at "|\\(-\\|[ \t]*$\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10841 (re-search-backward "|" (org-table-begin)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10842 (if (looking-at "| ?")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10843 (goto-char (match-end 0))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10844
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10845 (defun org-table-next-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10846 "Go to the next row (same column) in the current table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10847 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10848 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10849 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10850 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10851 (if (or (looking-at "[ \t]*$")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10852 (save-excursion (skip-chars-backward " \t") (bolp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10853 (newline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10854 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10855 org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10856 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10857 (let ((col (org-table-current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10858 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10859 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10860 (org-at-table-hline-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10861 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10862 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10863 (org-table-insert-row 'below)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10864 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10865 (skip-chars-backward "^|\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10866 (if (looking-at " ") (forward-char 1)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10867
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10868 (defun org-table-copy-down (n)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10869 "Copy a field down in the current column.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10870 If the field at the cursor is empty, copy into it the content of the nearest
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10871 non-empty field above. With argument N, use the Nth non-empty field.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
10872 If the current field is not empty, it is copied down to the next row, and
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10873 the cursor is moved with it. Therefore, repeating this command causes the
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10874 column to be filled row-by-row.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10875 If the variable `org-table-copy-increment' is non-nil and the field is an
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10876 integer, it will be incremented while copying."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10877 (interactive "p")
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
10878 (let* ((colpos (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10879 (field (org-table-get-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10880 (non-empty (string-match "[^ \t]" field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10881 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10882 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10883 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10884 (if non-empty
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10885 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10886 (setq txt (org-trim field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10887 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10888 (org-table-blank-field))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10889 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10890 (setq txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10891 (catch 'exit
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10892 (while (progn (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10893 (re-search-backward org-table-dataline-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10894 beg t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10895 (org-table-goto-column colpos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10896 (if (and (looking-at
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10897 "|[ \t]*\\([^| \t][^|]*?\\)[ \t]*|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10898 (= (setq n (1- n)) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10899 (throw 'exit (match-string 1))))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10900 (if txt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10901 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10902 (if (and org-table-copy-increment
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10903 (string-match "^[0-9]+$" txt))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
10904 (setq txt (format "%d" (+ (string-to-number txt) 1))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10905 (insert txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10906 (org-table-maybe-recalculate-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10907 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10908 (error "No non-empty field found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10909
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10910 (defun org-table-check-inside-data-field ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10911 "Is point inside a table data field?
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10912 I.e. not on a hline or before the first or after the last column?
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10913 This actually throws an error, so it aborts the current command."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10914 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10915 (= (org-table-current-column) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10916 (org-at-table-hline-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10917 (looking-at "[ \t]*$"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10918 (error "Not in table data field")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10919
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10920 (defvar org-table-clip nil
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
10921 "Clipboard for table regions.")
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10922
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10923 (defun org-table-blank-field ()
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10924 "Blank the current table field or active region."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10925 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10926 (org-table-check-inside-data-field)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10927 (if (and (interactive-p) (org-region-active-p))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10928 (let (org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10929 (org-table-cut-region (region-beginning) (region-end)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10930 (skip-chars-backward "^|")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10931 (backward-char 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10932 (if (looking-at "|[^|\n]+")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10933 (let* ((pos (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10934 (match (match-string 0))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10935 (len (org-string-width match)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10936 (replace-match (concat "|" (make-string (1- len) ?\ )))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10937 (goto-char (+ 2 pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10938 (substring match 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10939
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10940 (defun org-table-get-field (&optional n replace)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10941 "Return the value of the field in column N of current row.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10942 N defaults to current field.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10943 If REPLACE is a string, replace field with this value. The return value
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10944 is always the old value."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10945 (and n (org-table-goto-column n))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10946 (skip-chars-backward "^|\n")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10947 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10948 (if (looking-at "|[^|\r\n]*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10949 (let* ((pos (match-beginning 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10950 (val (buffer-substring (1+ pos) (match-end 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10951 (if replace
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10952 (replace-match (concat "|" replace)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10953 (goto-char (min (point-at-eol) (+ 2 pos)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10954 val)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10955 (forward-char 1) ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10956
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10957 (defun org-table-current-column ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10958 "Find out which column we are in.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10959 When called interactively, column is also displayed in echo area."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10960 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10961 (if (interactive-p) (org-table-check-inside-data-field))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10962 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10963 (let ((cnt 0) (pos (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10964 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10965 (while (search-forward "|" pos t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10966 (setq cnt (1+ cnt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10967 (if (interactive-p) (message "This is table column %d" cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10968 cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10969
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10970 (defun org-table-goto-column (n &optional on-delim force)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10971 "Move the cursor to the Nth column in the current table line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10972 With optional argument ON-DELIM, stop with point before the left delimiter
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10973 of the field.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10974 If there are less than N fields, just go to after the last delimiter.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10975 However, when FORCE is non-nil, create new columns if necessary."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10976 (interactive "p")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10977 (let ((pos (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10978 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10979 (when (> n 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10980 (while (and (> (setq n (1- n)) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10981 (or (search-forward "|" pos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10982 (and force
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10983 (progn (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10984 (skip-chars-backward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10985 (insert " | "))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10986 ; (backward-char 2) t)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10987 (when (and force (not (looking-at ".*|")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10988 (save-excursion (end-of-line 1) (insert " | ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10989 (if on-delim
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10990 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10991 (if (looking-at " ") (forward-char 1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10992
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10993 (defun org-at-table-p (&optional table-type)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10994 "Return t if the cursor is inside an org-type table.
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10995 If TABLE-TYPE is non-nil, also check for table.el-type tables."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10996 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10997 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10998 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10999 (looking-at (if table-type org-table-any-line-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11000 org-table-line-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11001 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11002
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11003 (defun org-at-table.el-p ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11004 "Return t if and only if we are at a table.el table."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11005 (and (org-at-table-p 'any)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11006 (save-excursion
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11007 (goto-char (org-table-begin 'any))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11008 (looking-at org-table1-hline-regexp))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11009
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11010 (defun org-table-recognize-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11011 "If there is a table.el table nearby, recognize it and move into it."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11012 (if org-table-tab-recognizes-table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11013 (if (org-at-table.el-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11014 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11015 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11016 (if (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11017 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11018 (if (looking-at org-table1-hline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11019 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11020 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11021 (if (looking-at org-table-any-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11022 (beginning-of-line -1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11023 (if (re-search-forward "|" (org-table-end t) t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11024 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11025 (require 'table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11026 (if (table--at-cell-p (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11027 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11028 (message "recognizing table.el table...")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11029 (table-recognize-table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11030 (message "recognizing table.el table...done")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11031 (error "This should not happen..."))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11032 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11033 nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11034 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11035
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11036 (defun org-at-table-hline-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11037 "Return t if the cursor is inside a hline in a table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11038 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11039 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11040 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11041 (looking-at org-table-hline-regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11042 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11043
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11044 (defun org-table-insert-column ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11045 "Insert a new column into the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11046 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11047 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11048 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11049 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11050 (let* ((col (max 1 (org-table-current-column)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11051 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11052 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11053 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11054 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11055 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11056 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11057 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11058 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11059 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11060 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11061 (insert "| "))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11062 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11063 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11064 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11065 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11066 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11067 (org-table-modify-formulas 'insert col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11068
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11069 (defun org-table-find-dataline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11070 "Find a dataline in the current table, which is needed for column commands."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11071 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11072 (not (org-at-table-hline-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11073 t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11074 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11075 (end (org-table-end)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11076 (move-to-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11077 (while (and (< (point) end)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11078 (or (not (= (current-column) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11079 (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11080 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11081 (move-to-column col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11082 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11083 (not (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11084 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11085 (error
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11086 "Please position cursor in a data line for column operations")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11087
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11088 (defun org-table-delete-column ()
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
11089 "Delete a column from the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11090 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11091 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11092 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11093 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11094 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11095 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11096 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11097 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11098 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11099 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11100 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11101 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11102 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11103 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11104 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11105 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11106 (and (looking-at "|[^|\n]+|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11107 (replace-match "|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11108 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11109 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11110 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11111 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11112 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11113 (org-table-modify-formulas 'remove col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11114
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11115 (defun org-table-move-column-right ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11116 "Move column to the right."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11117 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11118 (org-table-move-column nil))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11119 (defun org-table-move-column-left ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11120 "Move column to the left."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11121 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11122 (org-table-move-column 'left))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11123
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11124 (defun org-table-move-column (&optional left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11125 "Move the current column to the right. With arg LEFT, move to the left."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11126 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11127 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11128 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11129 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11130 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11131 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11132 (col1 (if left (1- col) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11133 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11134 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11135 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11136 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11137 (colpos (if left (1- col) (1+ col))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11138 (if (and left (= col 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11139 (error "Cannot move column further left"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11140 (if (and (not left) (looking-at "[^|\n]*|[^|\n]*$"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11141 (error "Cannot move column further right"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11142 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11143 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11144 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11145 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11146 (org-table-goto-column col1 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11147 (and (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11148 (replace-match "|\\2|\\1|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11149 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11150 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11151 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11152 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11153 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11154 (org-table-modify-formulas 'swap col (if left (1- col) (1+ col)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11155
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11156 (defun org-table-move-row-down ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11157 "Move table row down."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11158 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11159 (org-table-move-row nil))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11160 (defun org-table-move-row-up ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11161 "Move table row up."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11162 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11163 (org-table-move-row 'up))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11164
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11165 (defun org-table-move-row (&optional up)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
11166 "Move the current table line down. With arg UP, move it up."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11167 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11168 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11169 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11170 (tonew (if up 0 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11171 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11172 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11173 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11174 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11175 (goto-char pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11176 (error "Cannot move row further")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11177 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11178 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11179 (setq pos (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11180 (setq txt (buffer-substring (point) (1+ (point-at-eol))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11181 (delete-region (point) (1+ (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11182 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11183 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11184 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11185 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11186
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11187 (defun org-table-insert-row (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11188 "Insert a new row above the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11189 With prefix ARG, insert below the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11190 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11191 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11192 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11193 (let* ((line (buffer-substring (point-at-bol) (point-at-eol)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11194 (new (org-table-clean-line line)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11195 ;; Fix the first field if necessary
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11196 (if (string-match "^[ \t]*| *[#$] *|" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11197 (setq new (replace-match (match-string 0 line) t t new)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11198 (beginning-of-line (if arg 2 1))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11199 (let (org-table-may-need-update) (insert-before-markers new "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11200 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11201 (re-search-forward "| ?" (point-at-eol) t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11202 (and org-table-may-need-update (org-table-align))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11203
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11204 (defun org-table-insert-hline (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11205 "Insert a horizontal-line below the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11206 With prefix ARG, insert above the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11207 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11208 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11209 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11210 (let ((line (org-table-clean-line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11211 (buffer-substring (point-at-bol) (point-at-eol))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11212 (col (current-column)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11213 (while (string-match "|\\( +\\)|" line)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
11214 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11215 (concat "+" (make-string (- (match-end 1) (match-beginning 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11216 ?-) "|") t t line)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11217 (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11218 (beginning-of-line (if arg 1 2))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11219 (insert line "\n")
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
11220 (beginning-of-line (if arg 1 -1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11221 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11222
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11223 (defun org-table-clean-line (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11224 "Convert a table line S into a string with only \"|\" and space.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11225 In particular, this does handle wide and invisible characters."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11226 (if (string-match "^[ \t]*|-" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11227 ;; It's a hline, just map the characters
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
11228 (setq s (mapconcat (lambda (x) (if (member x '(?| ?+)) "|" " ")) s ""))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11229 (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11230 (setq s (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11231 (concat "|" (make-string (org-string-width (match-string 1 s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11232 ?\ ) "|")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11233 t t s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11234 s))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
11235
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11236 (defun org-table-kill-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11237 "Delete the current row or horizontal line from the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11238 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11239 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11240 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11241 (let ((col (current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11242 (kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11243 (if (not (org-at-table-p)) (beginning-of-line 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11244 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11245
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11246 (defun org-table-sort-lines (beg end numericp)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11247 "Sort table lines in region.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11248 Point and mark define the first and last line to include. Both point and
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11249 mark should be in the column that is used for sorting. For example, to
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11250 sort according to column 3, put the mark in the first line to sort, in
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11251 table column 3. Put point into the last line to be included in the sorting,
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
11252 also in table column 3. The command will prompt for the sorting method
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
11253 \(n for numerical, a for alphanumeric)."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11254 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11255 (setq numericp (string-match "[nN]" numericp))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11256 (org-table-align) ;; Just to be safe
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11257 (let* (bcol ecol cmp column lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11258 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11259 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11260 (setq column (org-table-current-column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11261 beg (move-marker (make-marker) (point-at-bol)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11262 (goto-char end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11263 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11264 (setq end (move-marker (make-marker) (1+ (point-at-eol))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11265 (untabify beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11266 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11267 (org-table-goto-column column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11268 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11269 (setq bcol (current-column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11270 (org-table-goto-column (1+ column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11271 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11272 (setq ecol (1- (current-column)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11273 (setq cmp (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11274 (lambda (a b) (< (car a) (car b)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11275 (lambda (a b) (string< (car a) (car b)))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11276 (setq lns (mapcar (lambda(x) (cons (org-trim (substring x bcol ecol)) x))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
11277 (org-split-string (buffer-substring beg end) "\n")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11278 (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11279 (setq lns (mapcar (lambda(x)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11280 (cons (string-to-number (car x)) (cdr x)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11281 lns)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11282 (delete-region beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11283 (move-marker beg nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11284 (move-marker end nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11285 (insert (mapconcat 'cdr (setq lns (sort lns cmp)) "\n") "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11286 (message "%d lines sorted %s based on column %d"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11287 (length lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11288 (if numericp "numerically" "alphabetically") column)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11289
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11290 (defun org-table-cut-region (beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11291 "Copy region in table to the clipboard and blank all relevant fields."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11292 (interactive "r")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11293 (org-table-copy-region beg end 'cut))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11294
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11295 (defun org-table-copy-region (beg end &optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11296 "Copy rectangular region in table to clipboard.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11297 A special clipboard is used which can only be accessed
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11298 with `org-table-paste-rectangle'."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11299 (interactive "rP")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11300 (let* (l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11301 region cols
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11302 (rpl (if cut " " nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11303 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11304 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11305 (setq l01 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11306 c01 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11307 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11308 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11309 (setq l02 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11310 c02 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11311 (setq l1 (min l01 l02) l2 (max l01 l02)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11312 c1 (min c01 c02) c2 (max c01 c02))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11313 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11314 (while t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11315 (catch 'nextline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11316 (if (> l1 l2) (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11317 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11318 (if (org-at-table-hline-p) (throw 'nextline (setq l1 (1+ l1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11319 (setq cols nil ic1 c1 ic2 c2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11320 (while (< ic1 (1+ ic2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11321 (push (org-table-get-field ic1 rpl) cols)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11322 (setq ic1 (1+ ic1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11323 (push (nreverse cols) region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11324 (setq l1 (1+ l1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11325 (setq org-table-clip (nreverse region))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11326 (if cut (org-table-align))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11327 org-table-clip))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
11328
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11329 (defun org-table-paste-rectangle ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11330 "Paste a rectangular region into a table.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11331 The upper right corner ends up in the current field. All involved fields
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11332 will be overwritten. If the rectangle does not fit into the present table,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11333 the table is enlarged as needed. The process ignores horizontal separator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11334 lines."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11335 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11336 (unless (and org-table-clip (listp org-table-clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11337 (error "First cut/copy a region to paste!"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11338 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11339 (let* ((clip org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11340 (line (count-lines (point-min) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11341 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11342 (org-enable-table-editor t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11343 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11344 c cols field)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11345 (while (setq cols (pop clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11346 (while (org-at-table-hline-p) (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11347 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11348 (progn (end-of-line 0) (org-table-next-field)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11349 (setq c col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11350 (while (setq field (pop cols))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11351 (org-table-goto-column c nil 'force)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11352 (org-table-get-field nil field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11353 (setq c (1+ c)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11354 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11355 (goto-line line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11356 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11357 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11358
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11359 (defun org-table-convert ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11360 "Convert from `org-mode' table to table.el and back.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11361 Obviously, this only works within limits. When an Org-mode table is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11362 converted to table.el, all horizontal separator lines get lost, because
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11363 table.el uses these as cell boundaries and has no notion of horizontal lines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11364 A table.el table can be converted to an Org-mode table only if it does not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11365 do row or column spanning. Multiline cells will become multiple cells.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11366 Beware, Org-mode does not test if the table can be successfully converted - it
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11367 blindly applies a recipe that works for simple tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11368 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11369 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11370 (if (org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11371 ;; convert to Org-mode table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11372 (let ((beg (move-marker (make-marker) (org-table-begin t)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11373 (end (move-marker (make-marker) (org-table-end t))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11374 (table-unrecognize-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11375 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11376 (while (re-search-forward "^\\([ \t]*\\)\\+-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11377 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11378 (goto-char beg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11379 (if (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11380 ;; convert to table.el table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11381 (let ((beg (move-marker (make-marker) (org-table-begin)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11382 (end (move-marker (make-marker) (org-table-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11383 ;; first, get rid of all horizontal lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11384 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11385 (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11386 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11387 ;; insert a hline before first
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11388 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11389 (org-table-insert-hline 'above)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
11390 (beginning-of-line -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11391 ;; insert a hline after each line
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
11392 (while (progn (beginning-of-line 3) (< (point) end))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11393 (org-table-insert-hline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11394 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11395 (setq end (move-marker end (org-table-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11396 ;; replace "+" at beginning and ending of hlines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11397 (while (re-search-forward "^\\([ \t]*\\)|-" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11398 (replace-match "\\1+-"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11399 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11400 (while (re-search-forward "-|[ \t]*$" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11401 (replace-match "-+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11402 (goto-char beg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11403
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11404 (defun org-table-wrap-region (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11405 "Wrap several fields in a column like a paragraph.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11406 This is useful if you'd like to spread the contents of a field over several
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11407 lines, in order to keep the table compact.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11408
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11409 If there is an active region, and both point and mark are in the same column,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11410 the text in the column is wrapped to minimum width for the given number of
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11411 lines. Generally, this makes the table more compact. A prefix ARG may be
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11412 used to change the number of desired lines. For example, `C-2 \\[org-table-wrap]'
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11413 formats the selected text to two lines. If the region was longer than two
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11414 lines, the remaining lines remain empty. A negative prefix argument reduces
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11415 the current number of lines by that amount. The wrapped text is pasted back
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11416 into the table. If you formatted it to more lines than it was before, fields
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11417 further down in the table get overwritten - so you might need to make space in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11418 the table first.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11419
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11420 If there is no region, the current field is split at the cursor position and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11421 the text fragment to the right of the cursor is prepended to the field one
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11422 line down.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11423
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11424 If there is no region, but you specify a prefix ARG, the current field gets
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11425 blank, and the content is appended to the field above."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11426 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11427 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11428 (if (org-region-active-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11429 ;; There is a region: fill as a paragraph
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11430 (let ((beg (region-beginning))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11431 nlines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11432 (org-table-cut-region (region-beginning) (region-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11433 (if (> (length (car org-table-clip)) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11434 (error "Region must be limited to single column"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11435 (setq nlines (if arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11436 (if (< arg 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11437 (+ (length org-table-clip) arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11438 arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11439 (length org-table-clip)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11440 (setq org-table-clip
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11441 (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11442 nil nlines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11443 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11444 (org-table-paste-rectangle))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11445 ;; No region, split the current field at point
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11446 (if arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11447 ;; combine with field above
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11448 (let ((s (org-table-blank-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11449 (col (org-table-current-column)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11450 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11451 (while (org-at-table-hline-p) (beginning-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11452 (org-table-goto-column col)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11453 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11454 (skip-chars-backward " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11455 (insert " " (org-trim s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11456 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11457 ;; split field
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11458 (when (looking-at "\\([^|]+\\)+|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11459 (let ((s (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11460 (replace-match " |")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11461 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11462 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11463 (insert (org-trim s) " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11464 (org-table-align))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11465
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11466 (defvar org-field-marker nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11467
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11468 (defun org-table-edit-field (arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11469 "Edit table field in a different window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11470 This is mainly useful for fields that contain hidden parts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11471 When called with a \\[universal-argument] prefix, just make the full field visible so that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11472 it can be edited in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11473 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11474 (if arg
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11475 (let ((b (save-excursion (skip-chars-backward "^|") (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11476 (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11477 (remove-text-properties b e '(org-cwidth t invisible t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11478 display t intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11479 (if (and (boundp 'font-lock-mode) font-lock-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11480 (font-lock-fontify-block)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11481 (let ((pos (move-marker (make-marker) (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11482 (field (org-table-get-field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11483 (cw (current-window-configuration))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11484 p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11485 (switch-to-buffer-other-window "*Org tmp*")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11486 (erase-buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11487 (insert "#\n# Edit field and finish with C-c C-c\n#\n")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11488 (org-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11489 (goto-char (setq p (point-max)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11490 (insert (org-trim field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11491 (remove-text-properties p (point-max)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11492 '(invisible t org-cwidth t display t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11493 intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11494 (goto-char p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11495 (set (make-local-variable 'org-finish-function)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11496 'org-table-finish-edit-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11497 (set (make-local-variable 'org-window-configuration) cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11498 (set (make-local-variable 'org-field-marker) pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11499 (message "Edit and finish with C-c C-c"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11500
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11501 (defun org-table-finish-edit-field ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11502 "Finish editing a table data field.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11503 Remove all newline characters, insert the result into the table, realign
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11504 the table and kill the editing buffer."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11505 (let ((pos org-field-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11506 (cw org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11507 (cb (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11508 text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11509 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11510 (while (re-search-forward "^#.*\n?" nil t) (replace-match ""))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11511 (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11512 (replace-match " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11513 (setq text (org-trim (buffer-string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11514 (set-window-configuration cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11515 (kill-buffer cb)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11516 (select-window (get-buffer-window (marker-buffer pos)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11517 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11518 (move-marker pos nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11519 (org-table-check-inside-data-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11520 (org-table-get-field nil text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11521 (org-table-align)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11522 (message "New field value inserted")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11523
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11524 (defun org-trim (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11525 "Remove whitespace at beginning and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11526 (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11527 (if (string-match "[ \t]+$" s) (setq s (replace-match "" t t s)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11528 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11529
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11530 (defun org-wrap (string &optional width lines)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11531 "Wrap string to either a number of lines, or a width in characters.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11532 If WIDTH is non-nil, the string is wrapped to that width, however many lines
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11533 that costs. If there is a word longer than WIDTH, the text is actually
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11534 wrapped to the length of that word.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11535 IF WIDTH is nil and LINES is non-nil, the string is forced into at most that
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11536 many lines, whatever width that takes.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11537 The return value is a list of lines, without newlines at the end."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11538 (let* ((words (org-split-string string "[ \t\n]+"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11539 (maxword (apply 'max (mapcar 'org-string-width words)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11540 w ll)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11541 (cond (width
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11542 (org-do-wrap words (max maxword width)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11543 (lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11544 (setq w maxword)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11545 (setq ll (org-do-wrap words maxword))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11546 (if (<= (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11547 ll
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11548 (setq ll words)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11549 (while (> (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11550 (setq w (1+ w))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11551 (setq ll (org-do-wrap words w)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11552 ll))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11553 (t (error "Cannot wrap this")))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
11554
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11555
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11556 (defun org-do-wrap (words width)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11557 "Create lines of maximum width WIDTH (in characters) from word list WORDS."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11558 (let (lines line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11559 (while words
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11560 (setq line (pop words))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11561 (while (and words (< (+ (length line) (length (car words))) width))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11562 (setq line (concat line " " (pop words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11563 (setq lines (push line lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11564 (nreverse lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11565
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11566 (defun org-split-string (string &optional separators)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11567 "Splits STRING into substrings at SEPARATORS.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11568 No empty strings are returned if there are matches at the beginning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11569 and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11570 (let ((rexp (or separators "[ \f\t\n\r\v]+"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11571 (start 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11572 notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11573 (list nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11574 (while (and (string-match rexp string
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11575 (if (and notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11576 (= start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11577 (< start (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11578 (1+ start) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11579 (< (match-beginning 0) (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11580 (setq notfirst t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11581 (or (eq (match-beginning 0) 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11582 (and (eq (match-beginning 0) (match-end 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11583 (eq (match-beginning 0) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11584 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11585 (cons (substring string start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11586 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11587 (setq start (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11588 (or (eq start (length string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11589 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11590 (cons (substring string start)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11591 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11592 (nreverse list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11593
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11594 (defun org-table-map-tables (function)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11595 "Apply FUNCTION to the start of all tables in the buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11596 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11597 (save-restriction
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11598 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11599 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11600 (while (re-search-forward org-table-any-line-regexp nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11601 (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11602 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11603 (if (looking-at org-table-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11604 (save-excursion (funcall function)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11605 (re-search-forward org-table-any-border-regexp nil 1))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11606 (message "Mapping tables: done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11607
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11608 (defun org-table-sum (&optional beg end nlast)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11609 "Sum numbers in region of current table column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11610 The result will be displayed in the echo area, and will be available
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11611 as kill to be inserted with \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11612
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11613 If there is an active region, it is interpreted as a rectangle and all
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11614 numbers in that rectangle will be summed. If there is no active
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11615 region and point is located in a table column, sum all numbers in that
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11616 column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11617
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11618 If at least one number looks like a time HH:MM or HH:MM:SS, all other
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11619 numbers are assumed to be times as well (in decimal hours) and the
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11620 numbers are added as such.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11621
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11622 If NLAST is a number, only the NLAST fields will actually be summed."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11623 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11624 (save-excursion
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11625 (let (col (timecnt 0) diff h m s org-table-clip)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11626 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11627 ((and beg end)) ; beg and end given explicitly
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11628 ((org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11629 (setq beg (region-beginning) end (region-end)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11630 (t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11631 (setq col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11632 (goto-char (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11633 (unless (re-search-forward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11634 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11635 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11636 ;not needed? (skip-chars-backward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11637 (setq beg (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11638 (goto-char (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11639 (unless (re-search-backward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11640 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11641 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11642 ;not needed? (skip-chars-forward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11643 (setq end (point))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11644 (let* ((items (apply 'append (org-table-copy-region beg end)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11645 (items1 (cond ((not nlast) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11646 ((>= nlast (length items)) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11647 (t (setq items (reverse items))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11648 (setcdr (nthcdr (1- nlast) items) nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11649 (nreverse items))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11650 (numbers (delq nil (mapcar 'org-table-get-number-for-summing
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11651 items1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11652 (res (apply '+ numbers))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11653 (sres (if (= timecnt 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11654 (format "%g" res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11655 (setq diff (* 3600 res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11656 h (floor (/ diff 3600)) diff (mod diff 3600)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11657 m (floor (/ diff 60)) diff (mod diff 60)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11658 s diff)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11659 (format "%d:%02d:%02d" h m s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11660 (kill-new sres)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11661 (if (interactive-p)
65705
7d20cbe1d616 (org-table-sum): Fix format string.
Juanma Barranquero <lekktu@gmail.com>
parents: 65654
diff changeset
11662 (message "%s"
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
11663 (substitute-command-keys
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
11664 (format "Sum of %d items: %-20s (\\[yank] will insert result into buffer)"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
11665 (length numbers) sres))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11666 sres))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11667
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11668 (defun org-table-get-number-for-summing (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11669 (let (n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11670 (if (string-match "^ *|? *" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11671 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11672 (if (string-match " *|? *$" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11673 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11674 (setq n (string-to-number s))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11675 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11676 ((and (string-match "0" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11677 (string-match "\\`[-+ \t0.edED]+\\'" s)) 0)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11678 ((string-match "\\`[ \t]+\\'" s) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11679 ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?\\'" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11680 (let ((h (string-to-number (or (match-string 1 s) "0")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11681 (m (string-to-number (or (match-string 2 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11682 (s (string-to-number (or (match-string 4 s) "0"))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11683 (if (boundp 'timecnt) (setq timecnt (1+ timecnt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11684 (* 1.0 (+ h (/ m 60.0) (/ s 3600.0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11685 ((equal n 0) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11686 (t n))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11687
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11688 (defun org-table-get-vertical-vector (desc &optional tbeg col)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11689 "Get a calc vector from a column, accorting to descriptor DESC.
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11690 Optional arguments TBEG and COL can give the beginning of the table and
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11691 the current column, to avoid unnecessary parsing."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11692 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11693 (or tbeg (setq tbeg (org-table-begin)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11694 (or col (setq col (org-table-current-column)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11695 (let (beg end nn n n1 n2 l (thisline (org-current-line)) hline-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11696 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11697 ((string-match "\\(I+\\)\\(-\\(I+\\)\\)?" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11698 (setq n1 (- (match-end 1) (match-beginning 1)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11699 (if (match-beginning 3)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11700 (setq n2 (- (match-end 2) (match-beginning 3))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11701 (setq n (if n2 (max n1 n2) n1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11702 (setq n1 (if n2 (min n1 n2)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11703 (setq nn n)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11704 (while (and (> nn 0)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11705 (re-search-backward org-table-hline-regexp tbeg t))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11706 (push (org-current-line) hline-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11707 (setq nn (1- nn)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11708 (setq hline-list (nreverse hline-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11709 (goto-line (nth (1- n) hline-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11710 (when (re-search-forward org-table-dataline-regexp)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11711 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11712 (setq beg (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11713 (goto-line (if n1 (nth (1- n1) hline-list) thisline))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11714 (when (re-search-backward org-table-dataline-regexp)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11715 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11716 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11717 (setq l (apply 'append (org-table-copy-region beg end)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11718 (concat "[" (mapconcat (lambda (x) (setq x (org-trim x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11719 (if (equal x "") "0" x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11720 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11721 ((string-match "\\([0-9]+\\)-\\([0-9]+\\)" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11722 (setq n1 (string-to-number (match-string 1 desc))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11723 n2 (string-to-number (match-string 2 desc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11724 (beginning-of-line 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11725 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11726 (when (re-search-backward org-table-dataline-regexp tbeg t n1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11727 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11728 (setq beg (point))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11729 (when (re-search-backward org-table-dataline-regexp tbeg t n2)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11730 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11731 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11732 (setq l (apply 'append (org-table-copy-region beg end)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11733 (concat "[" (mapconcat
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11734 (lambda (x) (setq x (org-trim x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11735 (if (equal x "") "0" x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11736 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11737 ((string-match "\\([0-9]+\\)" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11738 (beginning-of-line 1)
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
11739 (when (re-search-backward org-table-dataline-regexp tbeg t
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11740 (string-to-number (match-string 0 desc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11741 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11742 (org-trim (org-table-get-field))))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11743
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11744 (defvar org-table-formula-history nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11745
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11746 (defvar org-table-column-names nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11747 "Alist with column names, derived from the `!' line.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11748 (defvar org-table-column-name-regexp nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11749 "Regular expression matching the current column names.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11750 (defvar org-table-local-parameters nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11751 "Alist with parameter names, derived from the `$' line.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11752 (defvar org-table-named-field-locations nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11753 "Alist with locations of named fields.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11754
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11755 (defun org-table-get-formula (&optional equation named)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11756 "Read a formula from the minibuffer, offer stored formula as default."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11757 (let* ((name (car (rassoc (list (org-current-line)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11758 (org-table-current-column))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11759 org-table-named-field-locations)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11760 (scol (if named
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11761 (if name name
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11762 (error "Not in a named field"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11763 (int-to-string (org-table-current-column))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11764 (dummy (and name (not named)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11765 (not (y-or-n-p "Replace named-field formula with column equation? " ))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11766 (error "Abort")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11767 (org-table-may-need-update nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11768 (stored-list (org-table-get-stored-formulas))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11769 (stored (cdr (assoc scol stored-list)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11770 (eq (cond
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
11771 ((and stored equation (string-match "^ *=? *$" equation))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11772 stored)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11773 ((stringp equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11774 equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11775 (t (read-string
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11776 (format "%s formula $%s=" (if named "Field" "Column") scol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11777 (or stored "") 'org-table-formula-history
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11778 ;stored
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11779 ))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11780 mustsave)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11781 (when (not (string-match "\\S-" eq))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11782 ;; remove formula
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11783 (setq stored-list (delq (assoc scol stored-list) stored-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11784 (org-table-store-formulas stored-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11785 (error "Formula removed"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11786 (if (string-match "^ *=?" eq) (setq eq (replace-match "" t t eq)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11787 (if (string-match " *$" eq) (setq eq (replace-match "" t t eq)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11788 (if (and name (not named))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11789 ;; We set the column equation, delete the named one.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11790 (setq stored-list (delq (assoc name stored-list) stored-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11791 mustsave t))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11792 (if stored
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11793 (setcdr (assoc scol stored-list) eq)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11794 (setq stored-list (cons (cons scol eq) stored-list)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11795 (if (or mustsave (not (equal stored eq)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11796 (org-table-store-formulas stored-list))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11797 eq))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11798
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11799 (defun org-table-store-formulas (alist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11800 "Store the list of formulas below the current table."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11801 (setq alist (sort alist (lambda (a b) (string< (car a) (car b)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11802 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11803 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11804 (if (looking-at "\\([ \t]*\n\\)*#\\+TBLFM:.*\n?")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11805 (delete-region (point) (match-end 0)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11806 (insert "#+TBLFM: "
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11807 (mapconcat (lambda (x)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11808 (concat "$" (car x) "=" (cdr x)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11809 alist "::")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11810 "\n")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11811
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11812 (defun org-table-get-stored-formulas ()
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
11813 "Return an alist with the stored formulas directly after current table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11814 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11815 (let (scol eq eq-alist strings string seen)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11816 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11817 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11818 (when (looking-at "\\([ \t]*\n\\)*#\\+TBLFM: *\\(.*\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11819 (setq strings (org-split-string (match-string 2) " *:: *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11820 (while (setq string (pop strings))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11821 (when (string-match "\\$\\([a-zA-Z0-9]+\\) *= *\\(.*[^ \t]\\)" string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11822 (setq scol (match-string 1 string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11823 eq (match-string 2 string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11824 eq-alist (cons (cons scol eq) eq-alist))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11825 (if (member scol seen)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11826 (error "Double definition `$%s=' in TBLFM line, please fix by hand" scol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11827 (push scol seen))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11828 (nreverse eq-alist)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11829
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11830 (defun org-table-modify-formulas (action &rest columns)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11831 "Modify the formulas stored below the current table.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11832 ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11833 expected, for the other actions only a single column number is needed."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11834 (let ((list (org-table-get-stored-formulas))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
11835 (nmax (length (org-split-string
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11836 (buffer-substring (point-at-bol) (point-at-eol))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11837 "|")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11838 col col1 col2 scol si sc1 sc2)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11839 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11840 ((null list)) ; No action needed if there are no stored formulas
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11841 ((eq action 'remove)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11842 (setq col (car columns)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11843 scol (int-to-string col))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11844 (org-table-replace-in-formulas list scol "INVALID")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11845 (if (assoc scol list) (setq list (delq (assoc scol list) list)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11846 (loop for i from (1+ col) upto nmax by 1 do
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11847 (setq si (int-to-string i))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11848 (org-table-replace-in-formulas list si (int-to-string (1- i)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11849 (if (assoc si list) (setcar (assoc si list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11850 (int-to-string (1- i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11851 ((eq action 'insert)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11852 (setq col (car columns))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11853 (loop for i from nmax downto col by 1 do
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11854 (setq si (int-to-string i))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11855 (org-table-replace-in-formulas list si (int-to-string (1+ i)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11856 (if (assoc si list) (setcar (assoc si list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11857 (int-to-string (1+ i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11858 ((eq action 'swap)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11859 (setq col1 (car columns) col2 (nth 1 columns)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11860 sc1 (int-to-string col1) sc2 (int-to-string col2))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11861 ;; Hopefully, ZqZtZ will never be a name in a table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11862 (org-table-replace-in-formulas list sc1 "ZqZtZ")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11863 (org-table-replace-in-formulas list sc2 sc1)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11864 (org-table-replace-in-formulas list "ZqZtZ" sc2)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11865 (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZtZ"))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11866 (if (assoc sc2 list) (setcar (assoc sc2 list) sc1))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11867 (if (assoc "ZqZtZ" list) (setcar (assoc "ZqZtZ" list) sc2)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11868 (t (error "Invalid action in `org-table-modify-formulas'")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11869 (if list (org-table-store-formulas list))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11870
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11871 (defun org-table-replace-in-formulas (list s1 s2)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11872 (let (elt re s)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11873 (setq s1 (concat "$" (if (integerp s1) (int-to-string s1) s1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11874 s2 (concat "$" (if (integerp s2) (int-to-string s2) s2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11875 re (concat (regexp-quote s1) "\\>"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11876 (while (setq elt (pop list))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11877 (setq s (cdr elt))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11878 (while (string-match re s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11879 (setq s (replace-match s2 t t s)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11880 (setcdr elt s))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11881
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11882 (defun org-table-get-specials ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11883 "Get the column names and local parameters for this table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11884 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11885 (let ((beg (org-table-begin)) (end (org-table-end))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11886 names name fields fields1 field cnt c v line col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11887 (setq org-table-column-names nil
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11888 org-table-local-parameters nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11889 org-table-named-field-locations nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11890 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11891 (when (re-search-forward "^[ \t]*| *! *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11892 (setq names (org-split-string (match-string 1) " *| *")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11893 cnt 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11894 (while (setq name (pop names))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11895 (setq cnt (1+ cnt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11896 (if (string-match "^[a-zA-Z][a-zA-Z0-9]*$" name)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11897 (push (cons name (int-to-string cnt)) org-table-column-names))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11898 (setq org-table-column-names (nreverse org-table-column-names))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11899 (setq org-table-column-name-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11900 (concat "\\$\\(" (mapconcat 'car org-table-column-names "\\|") "\\)\\>"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11901 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11902 (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11903 (setq fields (org-split-string (match-string 1) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11904 (while (setq field (pop fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11905 (if (string-match "^\\([a-zA-Z][a-zA-Z0-9]*\\|%\\) *= *\\(.*\\)" field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11906 (push (cons (match-string 1 field) (match-string 2 field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11907 org-table-local-parameters))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11908 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11909 (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11910 (setq c (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11911 fields (org-split-string (match-string 2) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11912 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11913 (beginning-of-line (if (equal c "_") 2 0))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
11914 (setq line (org-current-line) col 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11915 (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11916 (setq fields1 (org-split-string (match-string 1) " *| *"))))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11917 (while (and fields1 (setq field (pop fields)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11918 (setq v (pop fields1) col (1+ col))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11919 (when (and (stringp field) (stringp v)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11920 (string-match "^[a-zA-Z][a-zA-Z0-9]*$" field))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11921 (push (cons field v) org-table-local-parameters)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11922 (push (list field line col) org-table-named-field-locations)))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11923
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11924 (defun org-this-word ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11925 ;; Get the current word
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11926 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11927 (let ((beg (progn (skip-chars-backward "^ \t\n") (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11928 (end (progn (skip-chars-forward "^ \t\n") (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11929 (buffer-substring-no-properties beg end))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11930
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11931 (defun org-table-maybe-eval-formula ()
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11932 "Check if the current field starts with \"=\" or \":=\".
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11933 If yes, store the formula and apply it."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11934 ;; We already know we are in a table. Get field will only return a formula
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11935 ;; when appropriate. It might return a separator line, but no problem.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11936 (when org-table-formula-evaluate-inline
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11937 (let* ((field (org-trim (or (org-table-get-field) "")))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11938 named eq)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
11939 (when (string-match "^:?=\\(.*\\)" field)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11940 (setq named (equal (string-to-char field) ?:)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11941 eq (match-string 1 field))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11942 (if (fboundp 'calc-eval)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11943 (org-table-eval-formula (if named '(4) nil) eq))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11944
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11945 (defvar org-recalc-commands nil
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11946 "List of commands triggering the recalculation of a line.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11947 Will be filled automatically during use.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11948
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11949 (defvar org-recalc-marks
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11950 '((" " . "Unmarked: no special line, no automatic recalculation")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11951 ("#" . "Automatically recalculate this line upon TAB, RET, and C-c C-c in the line")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11952 ("*" . "Recalculate only when entire table is recalculated with `C-u C-c *'")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11953 ("!" . "Column name definition line. Reference in formula as $name.")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11954 ("$" . "Parameter definition line name=value. Reference in formula as $name.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11955 ("_" . "Names for values in row below this one.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11956 ("^" . "Names for values in row above this one.")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11957
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11958 (defun org-table-rotate-recalc-marks (&optional newchar)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11959 "Rotate the recalculation mark in the first column.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11960 If in any row, the first field is not consistent with a mark,
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11961 insert a new column for the markers.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11962 When there is an active region, change all the lines in the region,
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11963 after prompting for the marking character.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11964 After each change, a message will be displayed indicating the meaning
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11965 of the new mark."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11966 (interactive)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11967 (unless (org-at-table-p) (error "Not at a table"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11968 (let* ((marks (append (mapcar 'car org-recalc-marks) '(" ")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11969 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11970 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11971 (l (org-current-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11972 (l1 (if (org-region-active-p) (org-current-line (region-beginning))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11973 (l2 (if (org-region-active-p) (org-current-line (region-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11974 (have-col
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11975 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11976 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11977 (not (re-search-forward "^[ \t]*|[^-|][^|]*[^#!$*_^| \t][^|]*|" end t))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11978 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11979 (forcenew (car (assoc newchar org-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11980 epos new)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11981 (when l1
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11982 (message "Change region to what mark? Type # * ! $ or SPC: ")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11983 (setq newchar (char-to-string (read-char-exclusive))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
11984 forcenew (car (assoc newchar org-recalc-marks))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11985 (if (and newchar (not forcenew))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11986 (error "Invalid NEWCHAR `%s' in `org-table-rotate-recalc-marks'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11987 newchar))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11988 (if l1 (goto-line l1))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11989 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11990 (beginning-of-line 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11991 (unless (looking-at org-table-dataline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11992 (error "Not at a table data line")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11993 (unless have-col
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11994 (org-table-goto-column 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11995 (org-table-insert-column)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11996 (org-table-goto-column (1+ col)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11997 (setq epos (point-at-eol))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11998 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11999 (beginning-of-line 1)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12000 (org-table-get-field
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12001 1 (if (looking-at "^[ \t]*| *\\([#!$*^_ ]\\) *|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12002 (concat " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12003 (setq new (or forcenew
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12004 (cadr (member (match-string 1) marks))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12005 " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12006 " # ")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12007 (if (and l1 l2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12008 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12009 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12010 (while (progn (beginning-of-line 2) (not (= (org-current-line) l2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12011 (and (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12012 (org-table-get-field 1 (concat " " new " "))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12013 (goto-line l1)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12014 (if (not (= epos (point-at-eol))) (org-table-align))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12015 (goto-line l)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12016 (and (interactive-p) (message (cdr (assoc new org-recalc-marks))))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12017
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12018 (defun org-table-maybe-recalculate-line ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12019 "Recompute the current line if marked for it, and if we haven't just done it."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12020 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12021 (and org-table-allow-automatic-line-recalculation
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12022 (not (and (memq last-command org-recalc-commands)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12023 (equal org-last-recalc-line (org-current-line))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12024 (save-excursion (beginning-of-line 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12025 (looking-at org-table-auto-recalculate-regexp))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12026 (fboundp 'calc-eval)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12027 (org-table-recalculate) t))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12028
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12029 (defvar org-table-formula-debug nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12030 "Non-nil means, debug table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12031 When nil, simply write \"#ERROR\" in corrupted fields.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12032
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12033 (defvar modes)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12034 (defsubst org-set-calc-mode (var &optional value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12035 (if (stringp var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12036 (setq var (assoc var '(("D" calc-angle-mode deg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12037 ("R" calc-angle-mode rad)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12038 ("F" calc-prefer-frac t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12039 ("S" calc-symbolic-mode t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12040 value (nth 2 var) var (nth 1 var)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12041 (if (memq var modes)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12042 (setcar (cdr (memq var modes)) value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12043 (cons var (cons value modes)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12044 modes)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12045
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12046 (defun org-table-eval-formula (&optional arg equation
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12047 suppress-align suppress-const
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12048 suppress-store)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12049 "Replace the table field value at the cursor by the result of a calculation.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12050
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12051 This function makes use of Dave Gillespie's Calc package, in my view the
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12052 most exciting program ever written for GNU Emacs. So you need to have Calc
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12053 installed in order to use this function.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12054
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12055 In a table, this command replaces the value in the current field with the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12056 result of a formula. It also installs the formula as the \"current\" column
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12057 formula, by storing it in a special line below the table. When called
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12058 with a `C-u' prefix, the current field must ba a named field, and the
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12059 formula is installed as valid in only this specific field.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12060
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12061 When called, the command first prompts for a formula, which is read in
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12062 the minibuffer. Previously entered formulas are available through the
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12063 history list, and the last used formula is offered as a default.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12064 These stored formulas are adapted correctly when moving, inserting, or
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12065 deleting columns with the corresponding commands.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12066
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12067 The formula can be any algebraic expression understood by the Calc package.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12068 For details, see the Org-mode manual.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12069
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12070 This function can also be called from Lisp programs and offers
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12071 additional arguments: EQUATION can be the formula to apply. If this
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12072 argument is given, the user will not be prompted. SUPPRESS-ALIGN is
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12073 used to speed-up recursive calls by by-passing unnecessary aligns.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12074 SUPPRESS-CONST suppresses the interpretation of constants in the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12075 formula, assuming that this has been done already outside the function.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12076 SUPPRESS-STORE means the formula should not be stored, either because
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12077 it is already stored, or because it is a modified equation that should
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12078 not overwrite the stored one."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12079 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12080 (require 'calc)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12081 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12082 (org-table-get-specials)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12083 (let* (fields
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12084 (ndown (if (integerp arg) arg 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12085 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12086 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12087 (down (> ndown 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12088 (formula (if (and equation suppress-store)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12089 equation
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12090 (org-table-get-formula equation (equal arg '(4)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12091 (n0 (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12092 (modes (copy-sequence org-calc-default-modes))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12093 n form fmt x ev orig c lispp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12094 ;; Parse the format string. Since we have a lot of modes, this is
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12095 ;; a lot of work. However, I think calc still uses most of the time.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12096 (if (string-match ";" formula)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12097 (let ((tmp (org-split-string formula ";")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12098 (setq formula (car tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12099 fmt (concat (cdr (assoc "%" org-table-local-parameters))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12100 (nth 1 tmp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12101 (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12102 (setq c (string-to-char (match-string 1 fmt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12103 n (string-to-number (or (match-string 1 fmt) "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12104 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12105 (setq modes (org-set-calc-mode
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12106 'calc-float-format
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
12107 (list (cdr (assoc c '((?n . float) (?f . fix)
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
12108 (?s . sci) (?e . eng))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12109 n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12110 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12111 (while (string-match "[DRFS]" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12112 (setq modes (org-set-calc-mode (match-string 0 fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12113 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12114 (unless (string-match "\\S-" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12115 (setq fmt nil))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12116 (if (and (not suppress-const) org-table-formula-use-constants)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12117 (setq formula (org-table-formula-substitute-names formula)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12118 (setq orig (or (get-text-property 1 :orig-formula formula) "?"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12119 (while (> ndown 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12120 (setq fields (org-split-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12121 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12122 (point-at-bol) (point-at-eol)) " *| *"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12123 (if org-table-formula-numbers-only
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12124 (setq fields (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12125 (lambda (x) (number-to-string (string-to-number x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12126 fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12127 (setq ndown (1- ndown))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12128 (setq form (copy-sequence formula)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12129 lispp (equal (substring form 0 2) "'("))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12130 ;; Insert the references to fields in same row
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12131 (while (string-match "\\$\\([0-9]+\\)?" form)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12132 (setq n (if (match-beginning 1)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
12133 (string-to-number (match-string 1 form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12134 n0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12135 x (nth (1- n) fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12136 (unless x (error "Invalid field specifier \"%s\""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12137 (match-string 0 form)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12138 (if (equal x "") (setq x "0"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12139 (setq form (replace-match
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12140 (if lispp x (concat "(" x ")"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12141 t t form)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12142 ;; Insert ranges in current column
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12143 (while (string-match "\\&[-I0-9]+" form)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12144 (setq form (replace-match
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
12145 (save-match-data
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
12146 (org-table-get-vertical-vector (match-string 0 form)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
12147 nil n0))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
12148 t t form)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12149 (if lispp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12150 (setq ev (eval (eval (read form)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12151 ev (if (numberp ev) (number-to-string ev) ev))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12152 (setq ev (calc-eval (cons form modes)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12153 (if org-table-formula-numbers-only 'num))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12154
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12155 (when org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12156 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12157 (princ (format "Substitution history of formula
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12158 Orig: %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12159 $xyz-> %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12160 $1-> %s\n" orig formula form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12161 (if (listp ev)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12162 (princ (format " %s^\nError: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12163 (make-string (car ev) ?\-) (nth 1 ev)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12164 (princ (format "Result: %s\nFormat: %s\nFinal: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12165 ev (or fmt "NONE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12166 (if fmt (format fmt (string-to-number ev)) ev)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12167 (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12168 (unless (and (interactive-p) (not ndown))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12169 (unless (let (inhibit-redisplay)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12170 (y-or-n-p "Debugging Formula. Continue to next? "))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12171 (org-table-align)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12172 (error "Abort"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12173 (delete-window (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12174 (message "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12175 (if (listp ev) (setq fmt nil ev "#ERROR"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12176 (org-table-justify-field-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12177 (if fmt (format fmt (string-to-number ev)) ev))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12178 (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12179 (call-interactively 'org-return)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12180 (setq ndown 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12181 (and down (org-table-maybe-recalculate-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12182 (or suppress-align (and org-table-may-need-update
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12183 (org-table-align)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12184
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12185 (defun org-table-recalculate (&optional all noalign)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12186 "Recalculate the current table line by applying all stored formulas.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12187 With prefix arg ALL, do this for all lines in the table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12188 (interactive "P")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12189 (or (memq this-command org-recalc-commands)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12190 (setq org-recalc-commands (cons this-command org-recalc-commands)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12191 (unless (org-at-table-p) (error "Not at a table"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12192 (org-table-get-specials)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12193 (let* ((eqlist (sort (org-table-get-stored-formulas)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12194 (lambda (a b) (string< (car a) (car b)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12195 (inhibit-redisplay t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12196 (line-re org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12197 (thisline (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12198 (thiscol (org-table-current-column))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12199 beg end entry eqlnum eqlname eql (cnt 0) eq a name)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12200 ;; Insert constants in all formulas
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12201 (setq eqlist
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12202 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12203 (setcdr x (org-table-formula-substitute-names (cdr x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12204 x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12205 eqlist))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12206 ;; Split the equation list
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12207 (while (setq eq (pop eqlist))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12208 (if (<= (string-to-char (car eq)) ?9)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12209 (push eq eqlnum)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12210 (push eq eqlname)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12211 (setq eqlnum (nreverse eqlnum) eqlname (nreverse eqlname))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12212 (if all
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12213 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12214 (setq end (move-marker (make-marker) (1+ (org-table-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12215 (goto-char (setq beg (org-table-begin)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12216 (if (re-search-forward org-table-calculate-mark-regexp end t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12217 ;; This is a table with marked lines, only compute selected lines
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12218 (setq line-re org-table-recalculate-regexp)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12219 ;; Move forward to the first non-header line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12220 (if (and (re-search-forward org-table-dataline-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12221 (re-search-forward org-table-hline-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12222 (re-search-forward org-table-dataline-regexp end t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12223 (setq beg (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12224 nil))) ;; just leave beg where it is
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12225 (setq beg (point-at-bol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12226 end (move-marker (make-marker) (1+ (point-at-eol)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12227 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12228 (and all (message "Re-applying formulas to full table..."))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12229 (while (re-search-forward line-re end t)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12230 (unless (string-match "^ *[_^!$] *$" (org-table-get-field 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12231 ;; Unprotected line, recalculate
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12232 (and all (message "Re-applying formulas to full table...(line %d)"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12233 (setq cnt (1+ cnt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12234 (setq org-last-recalc-line (org-current-line))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12235 (setq eql eqlnum)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12236 (while (setq entry (pop eql))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12237 (goto-line org-last-recalc-line)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
12238 (org-table-goto-column (string-to-number (car entry)) nil 'force)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12239 (org-table-eval-formula nil (cdr entry) 'noalign 'nocst 'nostore))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12240 (goto-line thisline)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12241 (org-table-goto-column thiscol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12242 (or noalign (and org-table-may-need-update (org-table-align))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12243 (and all (message "Re-applying formulas to %d lines...done" cnt)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12244 ;; Now do the names fields
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12245 (while (setq eq (pop eqlname))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12246 (setq name (car eq)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12247 a (assoc name org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12248 (when a
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12249 (message "Re-applying formula to named field: %s" name)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12250 (goto-line (nth 1 a))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12251 (org-table-goto-column (nth 2 a))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12252 (org-table-eval-formula nil (cdr eq) 'noalign 'nocst 'nostore)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12253 ;; back to initial position
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12254 (goto-line thisline)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12255 (org-table-goto-column thiscol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12256 (or noalign (and org-table-may-need-update (org-table-align))
64518
7b82147924c7 (org-table-formula-substitute-names, org-table-get-vertical-vector): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 64515
diff changeset
12257 (and all (message "Re-applying formulas...done")))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12258
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12259 (defun org-table-formula-substitute-names (f)
64518
7b82147924c7 (org-table-formula-substitute-names, org-table-get-vertical-vector): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 64515
diff changeset
12260 "Replace $const with values in string F."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12261 (let ((start 0) a n1 n2 nn1 nn2 s (f1 f))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12262 ;; First, check for column names
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12263 (while (setq start (string-match org-table-column-name-regexp f start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12264 (setq start (1+ start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12265 (setq a (assoc (match-string 1 f) org-table-column-names))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12266 (setq f (replace-match (concat "$" (cdr a)) t t f)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12267 ;; Expand ranges to vectors
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12268 (while (string-match "\\$\\([0-9]+\\)\\.\\.\\.?\\$\\([0-9]+\\)" f)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12269 (setq n1 (string-to-number (match-string 1 f))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12270 n2 (string-to-number (match-string 2 f))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12271 nn1 (1+ (min n1 n2)) nn2 (max n1 n2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12272 s (concat "[($" (number-to-string (1- nn1)) ")"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12273 (loop for i from nn1 upto nn2 do
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12274 (setq s (concat s ",($" (int-to-string i) ")")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12275 (setq s (concat s "]"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12276 (if (< n2 n1) (setq s (concat "rev(" s ")")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12277 (setq f (replace-match s t t f)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12278 ;; Parameters and constants
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12279 (setq start 0)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12280 (while (setq start (string-match "\\$\\([a-zA-Z][a-zA-Z0-9]*\\)" f start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12281 (setq start (1+ start))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12282 (if (setq a (save-match-data
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12283 (org-table-get-constant (match-string 1 f))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12284 (setq f (replace-match (concat "(" a ")") t t f))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12285 (if org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12286 (put-text-property 0 (length f) :orig-formula f1 f))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12287 f))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12288
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12289 (defun org-table-get-constant (const)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12290 "Find the value for a parameter or constant in a formula.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12291 Parameters get priority."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12292 (or (cdr (assoc const org-table-local-parameters))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12293 (cdr (assoc const org-table-formula-constants))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12294 (and (fboundp 'constants-get) (constants-get const))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12295 "#UNDEFINED_NAME"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12296
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12297 (defvar org-edit-formulas-map (make-sparse-keymap))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12298 (define-key org-edit-formulas-map "\C-c\C-c" 'org-finish-edit-formulas)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12299 (define-key org-edit-formulas-map "\C-c\C-q" 'org-abort-edit-formulas)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12300 (define-key org-edit-formulas-map "\C-c?" 'org-show-variable)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12301
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12302 (defvar org-pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12303
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12304 (defun org-table-edit-formulas ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12305 "Edit the formulas of the current table in a separate buffer."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12306 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12307 (unless (org-at-table-p)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12308 (error "Not at a table"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12309 (org-table-get-specials)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12310 (let ((eql (org-table-get-stored-formulas))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12311 (pos (move-marker (make-marker) (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12312 (wc (current-window-configuration))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12313 entry loc s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12314 (switch-to-buffer-other-window "*Edit Formulas*")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12315 (erase-buffer)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12316 (fundamental-mode)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12317 (set (make-local-variable 'org-pos) pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12318 (set (make-local-variable 'org-window-configuration) wc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12319 (use-local-map org-edit-formulas-map)
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
12320 (setq s "# Edit formulas and finish with `C-c C-c'.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12321 # Use `C-u C-c C-c' to also appy them immediately to the entire table.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12322 # Use `C-c ?' to get information about $name at point.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12323 # To cancel editing, press `C-c C-q'.\n")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12324 (put-text-property 0 (length s) 'face 'font-lock-comment-face s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12325 (insert s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12326 (while (setq entry (pop eql))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12327 (when (setq loc (assoc (car entry) org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12328 (setq s (format "# Named formula, referring to column %d in line %d\n"
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12329 (nth 2 loc) (nth 1 loc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12330 (put-text-property 0 (length s) 'face 'font-lock-comment-face s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12331 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12332 (setq s (concat "$" (car entry) "=" (cdr entry) "\n"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12333 (remove-text-properties 0 (length s) '(face nil) s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12334 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12335 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12336 (message "Edit formulas and finish with `C-c C-c'.")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12337
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12338 (defun org-show-variable ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12339 "Show the location/value of the $ expression at point."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12340 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12341 (let (var (pos org-pos) (win (selected-window)) e)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12342 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12343 (or (looking-at "\\$") (skip-chars-backward "$a-zA-Z0-9"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12344 (if (looking-at "\\$\\([a-zA-Z0-9]+\\)")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12345 (setq var (match-string 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12346 (error "No variable at point")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12347 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12348 ((setq e (assoc var org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12349 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12350 (goto-line (nth 1 e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12351 (org-table-goto-column (nth 2 e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12352 (select-window win)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12353 (message "Named field, column %d of line %d" (nth 2 e) (nth 1 e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12354 ((setq e (assoc var org-table-column-names))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12355 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12356 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12357 (goto-char (org-table-begin))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
12358 (if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12359 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12360 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12361 (goto-char (match-beginning 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12362 (message "Named column (column %s)" (cdr e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12363 (error "Column name not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12364 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12365 ((string-match "^[0-9]$" var)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12366 ;; column number
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12367 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12368 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12369 (goto-char (org-table-begin))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12370 (recenter 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12371 (if (re-search-forward org-table-dataline-regexp
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12372 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12373 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12374 (goto-char (match-beginning 0))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12375 (org-table-goto-column (string-to-number var))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12376 (message "Column %s" var))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12377 (error "Column name not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12378 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12379 ((setq e (assoc var org-table-local-parameters))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12380 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12381 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12382 (goto-char (org-table-begin))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12383 (if (re-search-forward (concat "^[ \t]*| *\\$ *.*?| *\\(" var "=\\)") nil t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12384 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12385 (goto-char (match-beginning 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12386 (message "Local parameter."))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12387 (error "Parameter not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12388 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12389 (t
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12390 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12391 ((setq e (assoc var org-table-formula-constants))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12392 (message "Constant: $%s=%s in `org-table-formula-constants'." var (cdr e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12393 ((setq e (and (fboundp 'constants-get) (constants-get var)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12394 (message "Constant: $%s=%s, retrieved from `constants.el'." var e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12395 (t (error "Undefined name $%s" var)))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12396
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12397 (defun org-finish-edit-formulas (&optional arg)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12398 "Parse the buffer for formula definitions and install them.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12399 With prefix ARG, apply the new formulas to the table."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12400 (interactive "P")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12401 (let ((pos org-pos) eql)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12402 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12403 (while (re-search-forward "^\\$\\([a-zA-Z0-9]+\\) *= *\\(.*?\\) *$" nil t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12404 (push (cons (match-string 1) (match-string 2)) eql))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12405 (set-window-configuration org-window-configuration)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12406 (select-window (get-buffer-window (marker-buffer pos)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12407 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12408 (unless (org-at-table-p)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12409 (error "Lost table position - cannot install formulae"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12410 (org-table-store-formulas eql)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12411 (move-marker pos nil)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12412 (kill-buffer "*Edit Formulas*")
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
12413 (if arg
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12414 (org-table-recalculate 'all)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12415 (message "New formulas installed - press C-u C-c C-c to apply."))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12416
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12417 (defun org-abort-edit-formulas ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12418 "Abort editing formulas, without installing the changes."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12419 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12420 (let ((pos org-pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12421 (set-window-configuration org-window-configuration)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12422 (select-window (get-buffer-window (marker-buffer pos)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12423 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12424 (message "Formula editing aborted without installing changes")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12425
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12426 ;;; The orgtbl minor mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12427
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12428 ;; Define a minor mode which can be used in other modes in order to
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12429 ;; integrate the org-mode table editor.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12430
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12431 ;; This is really a hack, because the org-mode table editor uses several
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12432 ;; keys which normally belong to the major mode, for example the TAB and
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12433 ;; RET keys. Here is how it works: The minor mode defines all the keys
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12434 ;; necessary to operate the table editor, but wraps the commands into a
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12435 ;; function which tests if the cursor is currently inside a table. If that
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12436 ;; is the case, the table editor command is executed. However, when any of
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12437 ;; those keys is used outside a table, the function uses `key-binding' to
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12438 ;; look up if the key has an associated command in another currently active
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12439 ;; keymap (minor modes, major mode, global), and executes that command.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12440 ;; There might be problems if any of the keys used by the table editor is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12441 ;; otherwise used as a prefix key.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12442
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12443 ;; Another challenge is that the key binding for TAB can be tab or \C-i,
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12444 ;; likewise the binding for RET can be return or \C-m. Orgtbl-mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12445 ;; addresses this by checking explicitly for both bindings.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12446
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12447 ;; The optimized version (see variable `orgtbl-optimized') takes over
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12448 ;; all keys which are bound to `self-insert-command' in the *global map*.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12449 ;; Some modes bind other commands to simple characters, for example
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12450 ;; AUCTeX binds the double quote to `Tex-insert-quote'. With orgtbl-mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12451 ;; active, this binding is ignored inside tables and replaced with a
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12452 ;; modified self-insert.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12453
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12454 (defvar orgtbl-mode nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12455 "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
12456 table editor in arbitrary modes.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12457 (make-variable-buffer-local 'orgtbl-mode)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12458
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
12459 (defvar orgtbl-mode-map (make-keymap)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12460 "Keymap for `orgtbl-mode'.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12461
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12462 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12463 (defun turn-on-orgtbl ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12464 "Unconditionally turn on `orgtbl-mode'."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12465 (orgtbl-mode 1))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12466
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12467 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12468 (defun orgtbl-mode (&optional arg)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12469 "The `org-mode' table editor as a minor mode for use in other modes."
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12470 (interactive)
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
12471 (if (org-mode-p)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12472 ;; Exit without error, in case some hook functions calls this
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12473 ;; by accident in org-mode.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12474 (message "Orgtbl-mode is not useful in org-mode, command ignored")
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12475 (setq orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12476 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12477 (if orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12478 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12479 (and (orgtbl-setup) (defun orgtbl-setup () nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12480 ;; Make sure we are first in minor-mode-map-alist
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12481 (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12482 (and c (setq minor-mode-map-alist
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12483 (cons c (delq c minor-mode-map-alist)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12484 (set (make-local-variable (quote org-table-may-need-update)) t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12485 (org-add-hook 'before-change-functions 'org-before-change-function
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12486 nil 'local)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12487 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12488 auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12489 (set (make-local-variable 'auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12490 (if auto-fill-inhibit-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12491 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12492 "[ \t]*|"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12493 (org-add-to-invisibility-spec '(org-cwidth))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12494 (easy-menu-add orgtbl-mode-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12495 (run-hooks 'orgtbl-mode-hook))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12496 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12497 (org-cleanup-narrow-column-properties)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12498 (org-remove-from-invisibility-spec '(org-cwidth))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12499 (remove-hook 'before-change-functions 'org-before-change-function t)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12500 (easy-menu-remove orgtbl-mode-menu)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12501 (force-mode-line-update 'all))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12502
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12503 (defun org-cleanup-narrow-column-properties ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12504 "Remove all properties related to narrow-column invisibility."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12505 (let ((s 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12506 (while (setq s (text-property-any s (point-max)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12507 'display org-narrow-column-arrow))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12508 (remove-text-properties s (1+ s) '(display t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12509 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12510 (while (setq s (text-property-any s (point-max) 'org-cwidth 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12511 (remove-text-properties s (1+ s) '(org-cwidth t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12512 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12513 (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12514 (remove-text-properties s (1+ s) '(invisible t)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12515
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12516 ;; Install it as a minor mode.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12517 (put 'orgtbl-mode :included t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12518 (put 'orgtbl-mode :menu-tag "Org Table Mode")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12519 (add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12520
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12521 (defun orgtbl-make-binding (fun n &rest keys)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12522 "Create a function for binding in the table minor mode.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12523 FUN is the command to call inside a table. N is used to create a unique
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
12524 command name. KEYS are keys that should be checked in for a command
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12525 to execute outside of tables."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12526 (eval
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12527 (list 'defun
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12528 (intern (concat "orgtbl-hijacker-command-" (int-to-string n)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12529 '(arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12530 (concat "In tables, run `" (symbol-name fun) "'.\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12531 "Outside of tables, run the binding of `"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12532 (mapconcat (lambda (x) (format "%s" x)) keys "' or `")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12533 "'.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12534 '(interactive "p")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12535 (list 'if
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12536 '(org-at-table-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12537 (list 'call-interactively (list 'quote fun))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12538 (list 'let '(orgtbl-mode)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12539 (list 'call-interactively
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12540 (append '(or)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12541 (mapcar (lambda (k)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12542 (list 'key-binding k))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12543 keys)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12544 '('orgtbl-error))))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12545
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12546 (defun orgtbl-error ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12547 "Error when there is no default binding for a table key."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12548 (interactive)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12549 (error "This key is has no function outside tables"))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12550
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12551 (defun orgtbl-setup ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12552 "Setup orgtbl keymaps."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12553 (let ((nfunc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12554 (bindings
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12555 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12556 '([(meta shift left)] org-table-delete-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12557 '([(meta left)] org-table-move-column-left)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12558 '([(meta right)] org-table-move-column-right)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12559 '([(meta shift right)] org-table-insert-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12560 '([(meta shift up)] org-table-kill-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12561 '([(meta shift down)] org-table-insert-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12562 '([(meta up)] org-table-move-row-up)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12563 '([(meta down)] org-table-move-row-down)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12564 '("\C-c\C-w" org-table-cut-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12565 '("\C-c\M-w" org-table-copy-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12566 '("\C-c\C-y" org-table-paste-rectangle)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12567 '("\C-c-" org-table-insert-hline)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12568 ; '([(shift tab)] org-table-previous-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12569 '("\C-m" org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12570 (list (org-key 'S-return) 'org-table-copy-down)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12571 '([(meta return)] org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12572 '("\C-c\C-q" org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12573 '("\C-c?" org-table-current-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12574 '("\C-c " org-table-blank-field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12575 '("\C-c+" org-table-sum)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12576 '("\C-c=" org-table-eval-formula)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12577 '("\C-c'" org-table-edit-formulas)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12578 '("\C-c`" org-table-edit-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12579 '("\C-c*" org-table-recalculate)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12580 '("\C-c|" org-table-create-or-convert-from-region)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12581 '("\C-c^" org-table-sort-lines)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12582 '([(control ?#)] org-table-rotate-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12583 elt key fun cmd)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12584 (while (setq elt (pop bindings))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12585 (setq nfunc (1+ nfunc))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12586 (setq key (car elt)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12587 fun (nth 1 elt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12588 cmd (orgtbl-make-binding fun nfunc key))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12589 (define-key orgtbl-mode-map key cmd))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12590 ;; Special treatment needed for TAB and RET
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12591 (define-key orgtbl-mode-map [(return)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12592 (orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12593 (define-key orgtbl-mode-map "\C-m"
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12594 (orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12595 (define-key orgtbl-mode-map [(tab)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12596 (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12597 (define-key orgtbl-mode-map "\C-i"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12598 (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)])))
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12599 (define-key orgtbl-mode-map "\C-i"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12600 (orgtbl-make-binding 'orgtbl-tab 104 [(shift tab)]))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12601 (define-key orgtbl-mode-map "\C-c\C-c"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12602 (orgtbl-make-binding 'org-ctrl-c-ctrl-c 105 "\C-c\C-c"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12603 (when orgtbl-optimized
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12604 ;; If the user wants maximum table support, we need to hijack
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12605 ;; some standard editing functions
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12606 (org-remap orgtbl-mode-map
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12607 'self-insert-command 'orgtbl-self-insert-command
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12608 'delete-char 'org-delete-char
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12609 'delete-backward-char 'org-delete-backward-char)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12610 (define-key orgtbl-mode-map "|" 'org-force-self-insert))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12611 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12612 '("OrgTbl"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12613 ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12614 ["Next Field" org-cycle :active (org-at-table-p) :keys "TAB"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12615 ["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12616 ["Next Row" org-return :active (org-at-table-p) :keys "RET"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12617 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12618 ["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12619 ["Edit Field" org-table-edit-field :active (org-at-table-p) :keys "C-c ` "]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12620 ["Copy Field from Above"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12621 org-table-copy-down :active (org-at-table-p) :keys "S-RET"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12622 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12623 ("Column"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12624 ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12625 ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12626 ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12627 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12628 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12629 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12630 ("Row"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12631 ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12632 ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12633 ["Delete Row" org-shiftmetaup :active (org-at-table-p) :keys "M-S-<up>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12634 ["Insert Row" org-shiftmetadown :active (org-at-table-p) :keys "M-S-<down>"]
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12635 ["Sort lines in region" org-table-sort-lines (org-at-table-p) :keys "C-c ^"]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12636 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12637 ["Insert Hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"])
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12638 ("Rectangle"
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12639 ["Copy Rectangle" org-copy-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12640 ["Cut Rectangle" org-cut-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12641 ["Paste Rectangle" org-paste-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12642 ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p)])
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12643 "--"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12644 ["Set Column Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12645 ["Set Named Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12646 ["Edit Formulas" org-table-edit-formulas :active (org-at-table-p) :keys "C-c '"]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12647 ["Recalculate line" org-table-recalculate :active (org-at-table-p) :keys "C-c *"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12648 ["Recalculate all" (org-table-recalculate '(4)) :active (org-at-table-p) :keys "C-u C-c *"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12649 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks :active (org-at-table-p) :keys "C-c #"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12650 ["Sum Column/Rectangle" org-table-sum
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12651 :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12652 ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12653 ["Debug Formulas"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12654 (setq org-table-formula-debug (not org-table-formula-debug))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12655 :style toggle :selected org-table-formula-debug]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12656 ))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12657 t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12658
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12659 (defun orgtbl-tab (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12660 "Justification and field motion for `orgtbl-mode'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12661 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12662 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12663 (org-table-justify-field-maybe)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12664 (org-table-next-field)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12665
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12666 (defun orgtbl-ret ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12667 "Justification and field motion for `orgtbl-mode'."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12668 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12669 (org-table-justify-field-maybe)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12670 (org-table-next-row))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12671
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12672 (defun orgtbl-self-insert-command (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12673 "Like `self-insert-command', use overwrite-mode for whitespace in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12674 If the cursor is in a table looking at whitespace, the whitespace is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12675 overwritten, and the table is not marked as requiring realignment."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12676 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12677 (if (and (org-at-table-p)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12678 (or
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12679 (and org-table-auto-blank-field
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12680 (member last-command
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12681 '(orgtbl-hijacker-command-100
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12682 orgtbl-hijacker-command-101
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12683 orgtbl-hijacker-command-102
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12684 orgtbl-hijacker-command-103
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12685 orgtbl-hijacker-command-104
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12686 orgtbl-hijacker-command-105))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12687 (org-table-blank-field))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12688 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12689 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12690 (looking-at "[^|\n]* +|"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12691 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12692 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12693 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12694 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12695 (self-insert-command N))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12696 (setq org-table-may-need-update t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12697 (let (orgtbl-mode)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12698 (call-interactively (key-binding (vector last-input-event))))))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12699
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12700 (defun org-force-self-insert (N)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12701 "Needed to enforce self-insert under remapping."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12702 (interactive "p")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12703 (self-insert-command N))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12704
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12705 ;;; Exporting
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12706
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12707 (defconst org-level-max 20)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12708
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12709 (defvar org-export-html-preamble nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12710 "Preamble, to be inserted just after <body>. Set by publishing functions.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12711 (defvar org-export-html-postamble nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12712 "Preamble, to be inserted just before </body>. Set by publishing functions.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12713 (defvar org-export-html-auto-preamble t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12714 "Should default preamble be inserted? Set by publishing functions.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12715 (defvar org-export-html-auto-postamble t
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12716 "Should default postamble be inserted? Set by publishing functions.")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12717
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12718 (defconst org-export-plist-vars
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12719 '((:language . org-export-default-language)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12720 (:headline-levels . org-export-headline-levels)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12721 (:section-numbers . org-export-with-section-numbers)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12722 (:table-of-contents . org-export-with-toc)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
12723 (:archived-trees . org-export-with-archived-trees)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12724 (:emphasize . org-export-with-emphasize)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12725 (:sub-superscript . org-export-with-sub-superscripts)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12726 (:TeX-macros . org-export-with-TeX-macros)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
12727 (:LaTeX-fragments . org-export-with-LaTeX-fragments)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12728 (:fixed-width . org-export-with-fixed-width)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12729 (:timestamps . org-export-with-timestamps)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12730 (:tables . org-export-with-tables)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12731 (:table-auto-headline . org-export-highlight-first-table-line)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12732 (:style . org-export-html-style)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12733 (:convert-org-links . org-export-html-link-org-files-as-html)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12734 (:inline-images . org-export-html-inline-images)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12735 (:expand-quoted-html . org-export-html-expand)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12736 (:timestamp . org-export-html-with-timestamp)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12737 (:publishing-directory . org-export-publishing-directory)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12738 (:preamble . org-export-html-preamble)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12739 (:postamble . org-export-html-postamble)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12740 (:auto-preamble . org-export-html-auto-preamble)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12741 (:auto-postamble . org-export-html-auto-postamble)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12742 (:author . user-full-name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12743 (:email . user-mail-address)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12744
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12745 (defun org-default-export-plist ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12746 "Return the property list with default settings for the export variables."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12747 (let ((l org-export-plist-vars) rtn e)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12748 (while (setq e (pop l))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12749 (setq rtn (cons (car e) (cons (symbol-value (cdr e)) rtn))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12750 rtn))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12751
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12752 (defun org-infile-export-plist ()
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12753 "Return the property list with file-local settings for export."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12754 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12755 (goto-char 0)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12756 (let ((re (org-make-options-regexp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12757 '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12758 p key val text options)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12759 (while (re-search-forward re nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12760 (setq key (org-match-string-no-properties 1)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12761 val (org-match-string-no-properties 2))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12762 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12763 ((string-equal key "TITLE") (setq p (plist-put p :title val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12764 ((string-equal key "AUTHOR")(setq p (plist-put p :author val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12765 ((string-equal key "EMAIL") (setq p (plist-put p :email val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12766 ((string-equal key "LANGUAGE") (setq p (plist-put p :language val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12767 ((string-equal key "TEXT")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12768 (setq text (if text (concat text "\n" val) val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12769 ((string-equal key "OPTIONS") (setq options val))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12770 (setq p (plist-put p :text text))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12771 (when options
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12772 (let ((op '(("H" . :headline-levels)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12773 ("num" . :section-numbers)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12774 ("toc" . :table-of-contents)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12775 ("\\n" . :preserve-breaks)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12776 ("@" . :expand-quoted-html)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12777 (":" . :fixed-width)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12778 ("|" . :tables)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12779 ("^" . :sub-superscript)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12780 ("*" . :emphasize)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
12781 ("TeX" . :TeX-macros)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
12782 ("LaTeX" . :LaTeX-fragments)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12783 o)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12784 (while (setq o (pop op))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12785 (if (string-match (concat (regexp-quote (car o))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12786 ":\\([^ \t\n\r;,.]*\\)")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12787 options)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12788 (setq p (plist-put p (cdr o)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12789 (car (read-from-string
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12790 (match-string 1 options)))))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12791 p)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12792
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12793 (defun org-combine-plists (&rest plists)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12794 "Create a single property list from all plists in PLISTS.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12795 The process starts by copying the last list, and then setting properties
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12796 from the other lists. Settings in the first list are the most significant
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12797 ones and overrule settings in the other lists."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12798 (let ((rtn (copy-sequence (pop plists)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12799 p v ls)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12800 (while plists
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12801 (setq ls (pop plists))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12802 (while ls
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12803 (setq p (pop ls) v (pop ls))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12804 (setq rtn (plist-put rtn p v))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12805 rtn))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12806
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12807 (defun org-export-directory (type plist)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12808 (let* ((val (plist-get plist :publishing-directory))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12809 (dir (if (listp val)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12810 (or (cdr (assoc type val)) ".")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12811 val)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12812 dir))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
12813
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12814 (defun org-export-find-first-heading-line (list)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
12815 "Remove all lines from LIST which are before the first headline."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12816 (let ((orig-list list)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12817 (re (concat "^" outline-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12818 (while (and list
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12819 (not (string-match re (car list))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12820 (pop list))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12821 (or list orig-list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12822
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12823 (defun org-skip-comments (lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12824 "Skip lines starting with \"#\" and subtrees starting with COMMENT."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12825 (let ((re1 (concat "^\\(\\*+\\)[ \t]+" org-comment-string))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12826 (re2 "^\\(\\*+\\)[ \t\n\r]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12827 rtn line level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12828 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12829 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12830 ((and (string-match re1 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12831 (setq level (- (match-end 1) (match-beginning 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12832 ;; Beginning of a COMMENT subtree. Skip it.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12833 (while (and (setq line (pop lines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12834 (or (not (string-match re2 line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12835 (> (- (match-end 1) (match-beginning 1)) level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12836 (setq lines (cons line lines)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12837 ((string-match "^#" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12838 ;; an ordinary comment line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12839 )
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12840 ((and org-export-table-remove-special-lines
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
12841 (string-match "^[ \t]*|" line)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
12842 (or (string-match "^[ \t]*| *[!_^] *|" line)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
12843 (and (string-match "| *<[0-9]+> *|" line)
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
12844 (not (string-match "| *[^ <|]" line)))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12845 ;; a special table line that should be removed
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12846 )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12847 (t (setq rtn (cons line rtn)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12848 (nreverse rtn)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12849
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12850 (defun org-export (&optional arg)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12851 (interactive)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12852 (let ((help "[t] insert the export option template
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12853 \[v] limit export to visible part of outline tree
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12854
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12855 \[a] export as ASCII
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12856 \[h] export as HTML
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12857 \[b] export as HTML and browse immediately
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12858 \[x] export as XOXO
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12859
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12860 \[i] export current file as iCalendar file
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12861 \[I] export all agenda files as iCalendar files
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12862 \[c] export agenda files into combined iCalendar file
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12863
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12864 \[F] publish current file
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12865 \[P] publish current project
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12866 \[X] publish... (project will be prompted for)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12867 \[A] publish all projects")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12868 (cmds
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
12869 '((?t . org-insert-export-options-template)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
12870 (?v . org-export-visible)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12871 (?a . org-export-as-ascii)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12872 (?h . org-export-as-html)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12873 (?b . org-export-as-html-and-open)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12874 (?x . org-export-as-xoxo)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12875 (?i . org-export-icalendar-this-file)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12876 (?I . org-export-icalendar-all-agenda-files)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12877 (?c . org-export-icalendar-combine-agenda-files)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12878 (?F . org-publish-current-file)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12879 (?P . org-publish-current-project)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12880 (?X . org-publish)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12881 (?A . org-publish-all)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12882 r1 r2 ass)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12883 (save-window-excursion
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12884 (delete-other-windows)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12885 (with-output-to-temp-buffer "*Org Export/Publishing Help*"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12886 (princ help))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12887 (message "Select command: ")
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12888 (setq r1 (read-char-exclusive)))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12889 (setq r2 (if (< r1 27) (+ r1 96) r1))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12890 (if (setq ass (assq r2 cmds))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12891 (call-interactively (cdr ass))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12892 (error "No command associated with key %c" r1))))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
12893
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12894 ;; ASCII
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12895
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12896 (defconst org-html-entities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12897 '(("nbsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12898 ("iexcl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12899 ("cent")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12900 ("pound")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12901 ("curren")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12902 ("yen")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12903 ("brvbar")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12904 ("sect")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12905 ("uml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12906 ("copy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12907 ("ordf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12908 ("laquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12909 ("not")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12910 ("shy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12911 ("reg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12912 ("macr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12913 ("deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12914 ("plusmn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12915 ("sup2")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12916 ("sup3")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12917 ("acute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12918 ("micro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12919 ("para")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12920 ("middot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12921 ("odot"."o")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12922 ("star"."*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12923 ("cedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12924 ("sup1")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12925 ("ordm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12926 ("raquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12927 ("frac14")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12928 ("frac12")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12929 ("frac34")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12930 ("iquest")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12931 ("Agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12932 ("Aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12933 ("Acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12934 ("Atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12935 ("Auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12936 ("Aring") ("AA"."&Aring;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12937 ("AElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12938 ("Ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12939 ("Egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12940 ("Eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12941 ("Ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12942 ("Euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12943 ("Igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12944 ("Iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12945 ("Icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12946 ("Iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12947 ("ETH")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12948 ("Ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12949 ("Ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12950 ("Oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12951 ("Ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12952 ("Otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12953 ("Ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12954 ("times")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12955 ("Oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12956 ("Ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12957 ("Uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12958 ("Ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12959 ("Uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12960 ("Yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12961 ("THORN")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12962 ("szlig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12963 ("agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12964 ("aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12965 ("acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12966 ("atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12967 ("auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12968 ("aring")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12969 ("aelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12970 ("ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12971 ("egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12972 ("eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12973 ("ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12974 ("euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12975 ("igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12976 ("iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12977 ("icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12978 ("iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12979 ("eth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12980 ("ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12981 ("ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12982 ("oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12983 ("ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12984 ("otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12985 ("ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12986 ("divide")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12987 ("oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12988 ("ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12989 ("uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12990 ("ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12991 ("uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12992 ("yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12993 ("thorn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12994 ("yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12995 ("fnof")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12996 ("Alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12997 ("Beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12998 ("Gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12999 ("Delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13000 ("Epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13001 ("Zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13002 ("Eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13003 ("Theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13004 ("Iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13005 ("Kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13006 ("Lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13007 ("Mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13008 ("Nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13009 ("Xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13010 ("Omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13011 ("Pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13012 ("Rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13013 ("Sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13014 ("Tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13015 ("Upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13016 ("Phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13017 ("Chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13018 ("Psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13019 ("Omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13020 ("alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13021 ("beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13022 ("gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13023 ("delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13024 ("epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13025 ("varepsilon"."&epsilon;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13026 ("zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13027 ("eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13028 ("theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13029 ("iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13030 ("kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13031 ("lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13032 ("mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13033 ("nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13034 ("xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13035 ("omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13036 ("pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13037 ("rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13038 ("sigmaf") ("varsigma"."&sigmaf;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13039 ("sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13040 ("tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13041 ("upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13042 ("phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13043 ("chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13044 ("psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13045 ("omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13046 ("thetasym") ("vartheta"."&thetasym;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13047 ("upsih")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13048 ("piv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13049 ("bull") ("bullet"."&bull;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13050 ("hellip") ("dots"."&hellip;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13051 ("prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13052 ("Prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13053 ("oline")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13054 ("frasl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13055 ("weierp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13056 ("image")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13057 ("real")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13058 ("trade")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13059 ("alefsym")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13060 ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13061 ("uarr") ("uparrow"."&uarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13062 ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13063 ("darr")("downarrow"."&darr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13064 ("harr") ("leftrightarrow"."&harr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13065 ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13066 ("lArr") ("Leftarrow"."&lArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13067 ("uArr") ("Uparrow"."&uArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13068 ("rArr") ("Rightarrow"."&rArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13069 ("dArr") ("Downarrow"."&dArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13070 ("hArr") ("Leftrightarrow"."&hArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13071 ("forall")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13072 ("part") ("partial"."&part;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13073 ("exist") ("exists"."&exist;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13074 ("empty") ("emptyset"."&empty;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13075 ("nabla")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13076 ("isin") ("in"."&isin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13077 ("notin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13078 ("ni")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13079 ("prod")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13080 ("sum")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13081 ("minus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13082 ("lowast") ("ast"."&lowast;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13083 ("radic")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13084 ("prop") ("proptp"."&prop;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13085 ("infin") ("infty"."&infin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13086 ("ang") ("angle"."&ang;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13087 ("and") ("vee"."&and;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13088 ("or") ("wedge"."&or;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13089 ("cap")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13090 ("cup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13091 ("int")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13092 ("there4")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13093 ("sim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13094 ("cong") ("simeq"."&cong;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13095 ("asymp")("approx"."&asymp;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13096 ("ne") ("neq"."&ne;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13097 ("equiv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13098 ("le")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13099 ("ge")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13100 ("sub") ("subset"."&sub;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13101 ("sup") ("supset"."&sup;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13102 ("nsub")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13103 ("sube")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13104 ("supe")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13105 ("oplus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13106 ("otimes")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13107 ("perp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13108 ("sdot") ("cdot"."&sdot;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13109 ("lceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13110 ("rceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13111 ("lfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13112 ("rfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13113 ("lang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13114 ("rang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13115 ("loz") ("Diamond"."&loz;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13116 ("spades") ("spadesuit"."&spades;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13117 ("clubs") ("clubsuit"."&clubs;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13118 ("hearts") ("diamondsuit"."&hearts;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13119 ("diams") ("diamondsuit"."&diams;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13120 ("quot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13121 ("amp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13122 ("lt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13123 ("gt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13124 ("OElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13125 ("oelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13126 ("Scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13127 ("scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13128 ("Yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13129 ("circ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13130 ("tilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13131 ("ensp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13132 ("emsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13133 ("thinsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13134 ("zwnj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13135 ("zwj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13136 ("lrm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13137 ("rlm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13138 ("ndash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13139 ("mdash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13140 ("lsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13141 ("rsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13142 ("sbquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13143 ("ldquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13144 ("rdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13145 ("bdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13146 ("dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13147 ("Dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13148 ("permil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13149 ("lsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13150 ("rsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13151 ("euro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13152
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13153 ("arccos"."arccos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13154 ("arcsin"."arcsin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13155 ("arctan"."arctan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13156 ("arg"."arg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13157 ("cos"."cos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13158 ("cosh"."cosh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13159 ("cot"."cot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13160 ("coth"."coth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13161 ("csc"."csc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13162 ("deg"."deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13163 ("det"."det")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13164 ("dim"."dim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13165 ("exp"."exp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13166 ("gcd"."gcd")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13167 ("hom"."hom")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13168 ("inf"."inf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13169 ("ker"."ker")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13170 ("lg"."lg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13171 ("lim"."lim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13172 ("liminf"."liminf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13173 ("limsup"."limsup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13174 ("ln"."ln")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13175 ("log"."log")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13176 ("max"."max")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13177 ("min"."min")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13178 ("Pr"."Pr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13179 ("sec"."sec")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13180 ("sin"."sin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13181 ("sinh"."sinh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13182 ("sup"."sup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13183 ("tan"."tan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13184 ("tanh"."tanh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13185 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13186 "Entities for TeX->HTML translation.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13187 Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13188 \"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\").
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13189 In that case, \"\\ent\" will be translated to \"&other;\".
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13190 The list contains HTML entities for Latin-1, Greek and other symbols.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13191 It is supplemented by a number of commonly used TeX macros with appropriate
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13192 translations. There is currently no way for users to extend this.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13193
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13194 (defun org-cleaned-string-for-export (string &rest parameters)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13195 "Cleanup a buffer substring so that links can be created safely."
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13196 (interactive)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13197 (let* ((re-radio (and org-target-link-regexp
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13198 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13199 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13200 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13201 (re-archive (concat ":" org-archive-tag ":"))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13202 rtn)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13203 (save-excursion
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13204 (set-buffer (get-buffer-create " org-mode-tmp"))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13205 (erase-buffer)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13206 (insert string)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13207 (let ((org-inhibit-startup t)) (org-mode))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13208
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13209 ;; Get rid of archived trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13210 (when (not (eq org-export-with-archived-trees t))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13211 (goto-char (point-min))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13212 (while (re-search-forward re-archive nil t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13213 (if (not (org-on-heading-p))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13214 (org-end-of-subtree t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13215 (beginning-of-line 1)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13216 (delete-region
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13217 (if org-export-with-archived-trees (1+ (point-at-eol)) (point))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13218 (org-end-of-subtree)))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13219
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13220 ;; Find targets in comments and move them out of comments,
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13221 ;; but mark them as targets that should be invisible
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13222 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13223 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13224 (replace-match "\\1(INVISIBLE)"))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13225
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13226 ;; Find matches for radio targets and turn them into internal links
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13227 (goto-char (point-min))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13228 (when re-radio
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13229 (while (re-search-forward re-radio nil t)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13230 (replace-match "\\1[[\\2]]")))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13231
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13232 ;; Find all links that contain a newline and put them into a single line
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13233 (goto-char (point-min))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13234 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13235 (replace-match "\\1 \\3")
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13236 (goto-char (match-beginning 0)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13237
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13238 ;; Convert LaTeX fragments to images
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13239 (when (memq :LaTeX-fragments parameters)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13240 (org-format-latex
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13241 (concat "ltxpng/" (file-name-sans-extension
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13242 (file-name-nondirectory
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13243 org-current-export-file)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13244 org-current-export-dir nil "Creating LaTeX image %s"))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
13245 (message "Exporting...")
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13246
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13247 ;; Normalize links: Convert angle and plain links into bracket links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13248 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13249 (while (re-search-forward re-plain-link nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13250 (replace-match
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13251 (concat
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13252 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13253 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13254 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13255 (while (re-search-forward re-angle-link nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13256 (replace-match
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13257 (concat
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13258 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13259 t t))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13260
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13261 ;; Find multiline emphasis and put them into single line
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13262 (when (memq :emph-multiline parameters)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13263 (goto-char (point-min))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13264 (while (re-search-forward org-emph-re nil t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13265 (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13266 (goto-char (1- (match-end 0)))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13267
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13268 ;; Remove comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13269 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13270 (while (re-search-forward "^#.*\n?" nil t)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13271 (replace-match ""))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13272 (setq rtn (buffer-string)))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13273 (kill-buffer " org-mode-tmp")
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13274 rtn))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13275
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13276 (defun org-solidify-link-text (s &optional alist)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13277 "Take link text and make a safe target out of it."
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13278 (save-match-data
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13279 (let* ((rtn
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13280 (mapconcat
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13281 'identity
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13282 (org-split-string s "[ \t\r\n]+") "--"))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13283 (a (assoc rtn alist)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13284 (or (cdr a) rtn))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13285
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13286 (defun org-convert-to-odd-levels ()
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13287 "Convert an org-mode file with all levels allowed to one with odd levels.
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13288 This will leave level 1 alone, convert level 2 to level 3, level 3 to
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13289 level 5 etc."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13290 (interactive)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13291 (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13292 (let ((org-odd-levels-only nil) n)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13293 (save-excursion
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13294 (goto-char (point-min))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13295 (while (re-search-forward "^\\*\\*+" nil t)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13296 (setq n (1- (length (match-string 0))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13297 (while (>= (setq n (1- n)) 0)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13298 (org-demote))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13299 (end-of-line 1))))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13300
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13301
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13302 (defun org-convert-to-oddeven-levels ()
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13303 "Convert an org-mode file with only odd levels to one with odd and even levels.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13304 This promotes level 3 to level 2, level 5 to level 3 etc. If the file contains a
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13305 section with an even level, conversion would destroy the structure of the file. An error
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13306 is signaled in this case."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13307 (interactive)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13308 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13309 ;; First check if there are no even levels
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13310 (when (re-search-forward "^\\(\\*\\*\\)+[^*]" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13311 (org-show-hierarchy-above)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13312 (error "Not all levels are odd in this file. Conversion not possible."))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13313 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13314 (let ((org-odd-levels-only nil) n)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13315 (save-excursion
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13316 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13317 (while (re-search-forward "^\\*\\*+" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13318 (setq n (/ (length (match-string 0)) 2))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13319 (while (>= (setq n (1- n)) 0)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13320 (org-promote))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13321 (end-of-line 1))))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13322
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13323 (defun org-tr-level (n)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13324 "Make N odd if required."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13325 (if org-odd-levels-only (1+ (/ n 2)) n))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13326
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13327 (defvar org-last-level nil) ; dynamically scoped variable
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13328 (defvar org-ascii-current-indentation nil) ; For communication
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13329
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13330 (defun org-export-as-ascii (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13331 "Export the outline as a pretty ASCII file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13332 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13333 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13334 underlined headlines. The default is 3."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13335 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13336 (setq-default org-todo-line-regexp org-todo-line-regexp)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13337 (let* ((opt-plist (org-combine-plists (org-default-export-plist)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13338 (org-infile-export-plist)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13339 (region
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13340 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13341 (if (org-region-active-p) (region-beginning) (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13342 (if (org-region-active-p) (region-end) (point-max))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13343 (lines (org-export-find-first-heading-line
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13344 (org-skip-comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13345 (org-split-string
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13346 (org-cleaned-string-for-export region)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13347 "[\r\n]"))))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13348 (org-ascii-current-indentation '(0 . 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13349 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13350 (level 0) line txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13351 (umax nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13352 (case-fold-search nil)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13353 (filename (concat (file-name-as-directory
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13354 (org-export-directory :ascii opt-plist))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13355 (file-name-sans-extension
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13356 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13357 ".txt"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13358 (buffer (find-file-noselect filename))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13359 (levels-open (make-vector org-level-max nil))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13360 (odd org-odd-levels-only)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13361 (date (format-time-string "%Y/%m/%d" (current-time)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13362 (time (format-time-string "%X" (org-current-time)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13363 (author (plist-get opt-plist :author))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13364 (title (or (plist-get opt-plist :title)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13365 (file-name-sans-extension
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13366 (file-name-nondirectory buffer-file-name))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13367 (email (plist-get opt-plist :email))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13368 (language (plist-get opt-plist :language))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13369 (text nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13370 (todo nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13371 (lang-words nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13372
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13373 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13374 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13375
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13376 (find-file-noselect filename)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13377
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13378 (setq lang-words (or (assoc language org-export-language-setup)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13379 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13380 (if org-export-ascii-show-new-buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13381 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13382 (set-buffer buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13383 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13384 (fundamental-mode)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13385 ;; create local variables for all options, to make sure all called
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13386 ;; functions get the correct information
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13387 (mapcar (lambda (x)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13388 (set (make-local-variable (cdr x))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13389 (plist-get opt-plist (car x))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13390 org-export-plist-vars)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13391 (set (make-local-variable 'org-odd-levels-only) odd)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13392 (setq umax (if arg (prefix-numeric-value arg)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13393 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13394
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13395 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13396 (if title (org-insert-centered title ?=))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13397 (insert "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13398 (if (or author email)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13399 (insert (concat (nth 1 lang-words) ": " (or author "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13400 (if email (concat " <" email ">") "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13401 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13402 (if (and date time)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13403 (insert (concat (nth 2 lang-words) ": " date " " time "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13404 (if text (insert (concat (org-html-expand-for-ascii text) "\n\n")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13405
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13406 (insert "\n\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13407
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13408 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13409 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13410 (insert (nth 3 lang-words) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13411 (make-string (length (nth 3 lang-words)) ?=) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13412 (mapcar '(lambda (line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13413 (if (string-match org-todo-line-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13414 line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13415 ;; This is a headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13416 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13417 (setq level (- (match-end 1) (match-beginning 1))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13418 level (org-tr-level level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13419 txt (match-string 3 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13420 todo
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13421 (or (and org-export-mark-todo-in-toc
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13422 (match-beginning 2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13423 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13424 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13425 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13426 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13427 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13428 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13429 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13430 (setq txt (org-html-expand-for-ascii txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13431
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13432 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13433 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13434 " " txt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13435 (if (<= level umax)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13436 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13437 (insert
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13438 (make-string (* (1- level) 4) ?\ )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13439 (format (if todo "%s (*)\n" "%s\n") txt))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13440 (setq org-last-level level))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13441 ))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13442 lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13443
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13444 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13445 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13446 ;; Remove the quoted HTML tags.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13447 (setq line (org-html-expand-for-ascii line))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13448 ;; Remove targets
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13449 (while (string-match "<<<?[^<>]*>>>?[ \t]*\n?" line)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13450 (setq line (replace-match "" t t line)))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13451 ;; Replace internal links
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13452 (while (string-match org-bracket-link-regexp line)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13453 (setq line (replace-match
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13454 (if (match-end 3) "[\\3]" "[\\1]")
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13455 t nil line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13456 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13457 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13458 ;; a Headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13459 (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13460 txt (match-string 2 line))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13461 (org-ascii-level-start level txt umax lines))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13462 (t
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13463 (insert (org-fix-indentation line org-ascii-current-indentation) "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13464 (normal-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13465 (save-buffer)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13466 ;; remove display and invisible chars
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13467 (let (beg end)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13468 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13469 (while (setq beg (next-single-property-change (point) 'display))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13470 (setq end (next-single-property-change beg 'display))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13471 (delete-region beg end)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13472 (goto-char beg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13473 (insert "=>"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13474 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13475 (while (setq beg (next-single-property-change (point) 'org-cwidth))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13476 (setq end (next-single-property-change beg 'org-cwidth))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13477 (delete-region beg end)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13478 (goto-char beg)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13479 (goto-char (point-min))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13480
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13481 (defun org-search-todo-below (line lines level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13482 "Search the subtree below LINE for any TODO entries."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13483 (let ((rest (cdr (memq line lines)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13484 (re org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13485 line lv todo)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13486 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13487 (while (setq line (pop rest))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13488 (if (string-match re line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13489 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13490 (setq lv (- (match-end 1) (match-beginning 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13491 todo (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13492 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13493 org-done-string))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13494 ; TODO, not DONE
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13495 (if (<= lv level) (throw 'exit nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13496 (if todo (throw 'exit t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13497
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13498 (defun org-html-expand-for-ascii (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13499 "Handle quoted HTML for ASCII export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13500 (if org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13501 (while (string-match "@<[^<>\n]*>" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13502 ;; We just remove the tags for now.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13503 (setq line (replace-match "" nil nil line))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13504 line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13505
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13506 (defun org-insert-centered (s &optional underline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13507 "Insert the string S centered and underline it with character UNDERLINE."
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
13508 (let ((ind (max (/ (- 80 (string-width s)) 2) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13509 (insert (make-string ind ?\ ) s "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13510 (if underline
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13511 (insert (make-string ind ?\ )
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
13512 (make-string (string-width s) underline)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13513 "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13514
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13515 (defun org-ascii-level-start (level title umax &optional lines)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13516 "Insert a new level in ASCII export."
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13517 (let (char (n (- level umax 1)) (ind 0))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13518 (if (> level umax)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13519 (progn
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13520 (insert (make-string (* 2 n) ?\ )
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13521 (char-to-string (nth (% n (length org-export-ascii-bullets))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13522 org-export-ascii-bullets))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13523 " " title "\n")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13524 ;; find the indentation of the next non-empty line
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13525 (catch 'stop
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13526 (while lines
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13527 (if (string-match "^\\*" (car lines)) (throw 'stop nil))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13528 (if (string-match "^\\([ \t]*\\)\\S-" (car lines))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13529 (throw 'stop (setq ind (org-get-indentation (car lines)))))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13530 (pop lines)))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13531 (setq org-ascii-current-indentation (cons (* 2 (1+ n)) ind)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13532 (if (or (not (equal (char-before) ?\n))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13533 (not (equal (char-before (1- (point))) ?\n)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13534 (insert "\n"))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13535 (setq char (nth (- umax level) (reverse org-export-ascii-underline)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13536 (if org-export-with-section-numbers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13537 (setq title (concat (org-section-number level) " " title)))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13538 (insert title "\n" (make-string (string-width title) char) "\n")
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13539 (setq org-ascii-current-indentation '(0 . 0)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13540
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13541 (defun org-export-visible (type arg)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13542 "Create a copy of the visible part of the current buffer, and export it.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13543 The copy is created in a temporary buffer and removed after use.
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13544 TYPE is the final key (as a string) that also select the export command in
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13545 the `C-c C-e' export dispatcher.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13546 As a special case, if the you type SPC at the prompt, the temporary
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13547 org-mode file will not be removed but presented to you so that you can
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13548 continue to use it. The prefix arg ARG is passed through to the exporting
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13549 command."
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13550 (interactive
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13551 (list (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13552 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer")
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13553 (read-char-exclusive))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13554 current-prefix-arg))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13555 (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?x ?\ )))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13556 (error "Invalid export key"))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13557 (let* ((binding (cdr (assoc type
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13558 '((?a . org-export-as-ascii)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13559 (?\C-a . org-export-as-ascii)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13560 (?b . org-export-as-html-and-open)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13561 (?\C-b . org-export-as-html-and-open)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13562 (?h . org-export-as-html)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13563 (?x . org-export-as-xoxo)))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13564 (keepp (equal type ?\ ))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13565 (file buffer-file-name)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13566 (buffer (get-buffer-create "*Org Export Visible*"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13567 s e)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13568 (with-current-buffer buffer (erase-buffer))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13569 (save-excursion
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13570 (setq s (goto-char (point-min)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13571 (while (not (= (point) (point-max)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13572 (goto-char (org-find-invisible))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13573 (append-to-buffer buffer s (point))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13574 (setq s (goto-char (org-find-visible))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13575 (goto-char (point-min))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13576 (unless keepp
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13577 ;; Copy all comment lines to the end, to make sure #+ settings are
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13578 ;; still available for the second export step. Kind of a hack, but
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13579 ;; does do the trick.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13580 (if (looking-at "#[^\r\n]*")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13581 (append-to-buffer buffer (match-beginning 0) (1+ (match-end 0))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13582 (while (re-search-forward "[\n\r]#[^\n\r]*" nil t)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13583 (append-to-buffer buffer (1+ (match-beginning 0))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13584 (min (point-max) (1+ (match-end 0))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13585 (set-buffer buffer)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13586 (let ((buffer-file-name file)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13587 (org-inhibit-startup t))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13588 (org-mode)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13589 (show-all)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13590 (unless keepp (funcall binding arg))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13591 (if (not keepp)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13592 (kill-buffer buffer)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13593 (switch-to-buffer-other-window buffer)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13594 (goto-char (point-min)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13595
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13596 (defun org-find-visible ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13597 (if (featurep 'noutline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13598 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13599 (while (and (not (= (point-max) (setq s (next-overlay-change s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13600 (get-char-property s 'invisible)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13601 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13602 (skip-chars-forward "^\n")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13603 (point)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13604 (defun org-find-invisible ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13605 (if (featurep 'noutline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13606 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13607 (while (and (not (= (point-max) (setq s (next-overlay-change s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13608 (not (get-char-property s 'invisible))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13609 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13610 (skip-chars-forward "^\r")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
13611 (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13612
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
13613
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13614 ;; HTML
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13615
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13616 (defun org-get-current-options ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13617 "Return a string with current options as keyword options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13618 Does include HTML export options as well as TODO and CATEGORY stuff."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13619 (format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13620 "#+TITLE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13621 #+AUTHOR: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13622 #+EMAIL: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13623 #+LANGUAGE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13624 #+TEXT: Some descriptive text to be emitted. Several lines OK.
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13625 #+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s LaTeX:%s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13626 #+CATEGORY: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13627 #+SEQ_TODO: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13628 #+TYP_TODO: %s
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13629 #+STARTUP: %s %s %s %s %s %s
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13630 #+TAGS: %s
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13631 #+ARCHIVE: %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13632 "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13633 (buffer-name) (user-full-name) user-mail-address org-export-default-language
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13634 org-export-headline-levels
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13635 org-export-with-section-numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13636 org-export-with-toc
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13637 org-export-preserve-breaks
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13638 org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13639 org-export-with-fixed-width
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13640 org-export-with-tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13641 org-export-with-sub-superscripts
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13642 org-export-with-emphasize
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13643 org-export-with-TeX-macros
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13644 org-export-with-LaTeX-fragments
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13645 (file-name-nondirectory buffer-file-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13646 (if (equal org-todo-interpretation 'sequence)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13647 (mapconcat 'identity org-todo-keywords " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13648 "TODO FEEDBACK VERIFY DONE")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13649 (if (equal org-todo-interpretation 'type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13650 (mapconcat 'identity org-todo-keywords " ")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13651 "Me Jason Marie DONE")
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13652 (cdr (assoc org-startup-folded
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
13653 '((nil . "showall") (t . "overview") (content . "content"))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13654 (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13655 (if org-odd-levels-only "odd" "oddeven")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13656 (if org-hide-leading-stars "hidestars" "showstars")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13657 (if org-startup-align-all-tables "align" "noalign")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13658 (if org-log-done "logging" "nologging")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13659 (if org-tag-alist (mapconcat 'car org-tag-alist " ") "")
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13660 org-archive-location
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13661 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13662
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13663 (defun org-insert-export-options-template ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13664 "Insert into the buffer a template with information for exporting."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13665 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13666 (if (not (bolp)) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13667 (let ((s (org-get-current-options)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13668 (and (string-match "#\\+CATEGORY" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13669 (setq s (substring s 0 (match-beginning 0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13670 (insert s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13671
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13672 (defun org-toggle-fixed-width-section (arg)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13673 "Toggle the fixed-width export.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13674 If there is no active region, the QUOTE keyword at the current headline is
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13675 inserted or removed. When present, it causes the text between this headline
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13676 and the next to be exported as fixed-width text, and unmodified.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13677 If there is an active region, this command adds or removes a colon as the
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13678 first character of this line. If the first character of a line is a colon,
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13679 this line is also exported in fixed-width font."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13680 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13681 (let* ((cc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13682 (regionp (org-region-active-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13683 (beg (if regionp (region-beginning) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13684 (end (if regionp (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13685 (nlines (or arg (if (and beg end) (count-lines beg end) 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13686 (re "[ \t]*\\(:\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13687 off)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13688 (if regionp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13689 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13690 (goto-char beg)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13691 (setq cc (current-column))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13692 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13693 (setq off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13694 (while (> nlines 0)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13695 (setq nlines (1- nlines))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13696 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13697 (cond
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13698 (arg
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13699 (move-to-column cc t)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13700 (insert ":\n")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13701 (forward-line -1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13702 ((and off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13703 (replace-match "" t t nil 1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13704 ((not off) (move-to-column cc t) (insert ":")))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13705 (forward-line 1)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13706 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13707 (org-back-to-heading)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13708 (if (looking-at (concat outline-regexp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13709 "\\( +\\<" org-quote-string "\\>\\)"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13710 (replace-match "" t t nil 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13711 (if (looking-at outline-regexp)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13712 (progn
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13713 (goto-char (match-end 0))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
13714 (insert " " org-quote-string))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13715
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13716 (defun org-export-as-html-and-open (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13717 "Export the outline as HTML and immediately open it with a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13718 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13719 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13720 headlines. The default is 3. Lower levels will become bulleted lists."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13721 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13722 (org-export-as-html arg 'hidden)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
13723 (org-open-file buffer-file-name))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13724
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13725 (defun org-export-as-html-batch ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13726 "Call `org-export-as-html', may be used in batch processing as
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13727 emacs --batch
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13728 --load=$HOME/lib/emacs/org.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13729 --eval \"(setq org-export-headline-levels 2)\"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13730 --visit=MyFile --funcall org-export-as-html-batch"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13731 (org-export-as-html org-export-headline-levels 'hidden))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13732
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13733 (defun org-export-as-html (arg &optional hidden ext-plist)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13734 "Export the outline as a pretty HTML file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13735 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13736 The prefix ARG specifies how many levels of the outline should become
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13737 headlines. The default is 3. Lower levels will become bulleted lists.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13738 When HIDDEN is non-nil, don't display the HTML buffer.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13739 EXT-PLIST is a property list with external parameters overriding
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13740 org-mode's default settings, but still inferior to file-local settings."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13741 (interactive "P")
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13742 (message "Exporting...")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13743 (setq-default org-todo-line-regexp org-todo-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13744 (setq-default org-deadline-line-regexp org-deadline-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13745 (setq-default org-done-string org-done-string)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13746 (let* ((opt-plist (org-combine-plists (org-default-export-plist)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13747 ext-plist
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13748 (org-infile-export-plist)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13749
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13750 (style (plist-get opt-plist :style))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13751 (link-validate (plist-get opt-plist :link-validation-function))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13752 valid
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13753 (odd org-odd-levels-only)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13754 (region-p (org-region-active-p))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13755 (region
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13756 (buffer-substring
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13757 (if region-p (region-beginning) (point-min))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13758 (if region-p (region-end) (point-max))))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13759 ;; The following two are dynamically scoped into other
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13760 ;; routines below.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13761 (org-current-export-dir (org-export-directory :html opt-plist))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13762 (org-current-export-file buffer-file-name)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13763 (all_lines
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13764 (org-skip-comments (org-split-string
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13765 (org-cleaned-string-for-export
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13766 region :emph-multiline
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13767 (if (plist-get opt-plist :LaTeX-fragments)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
13768 :LaTeX-fragments))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13769 "[\r\n]")))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13770 (lines (org-export-find-first-heading-line all_lines))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13771 (level 0) (line "") (origline "") txt todo
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13772 (umax nil)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13773 (filename (concat (file-name-as-directory
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13774 (org-export-directory :html opt-plist))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13775 (file-name-sans-extension
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13776 (file-name-nondirectory buffer-file-name))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13777 ".html"))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
13778 (current-dir (file-name-directory buffer-file-name))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13779 (buffer (find-file-noselect filename))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13780 (levels-open (make-vector org-level-max nil))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13781 (date (format-time-string "%Y/%m/%d" (current-time)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13782 (time (format-time-string "%X" (org-current-time)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13783 (author (plist-get opt-plist :author))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13784 (title (or (plist-get opt-plist :title)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13785 (file-name-sans-extension
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13786 (file-name-nondirectory buffer-file-name))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13787 (quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13788 (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13789 (inquote nil)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13790 (infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13791 (in-local-list nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13792 (local-list-num nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13793 (local-list-indent nil)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13794 (llt org-plain-list-ordered-item-terminator)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13795 (email (plist-get opt-plist :email))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13796 (language (plist-get opt-plist :language))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13797 (text (plist-get opt-plist :text))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13798 (lang-words nil)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13799 (target-alist nil) tg
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13800 (head-count 0) cnt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13801 (start 0)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
13802 (coding-system (and (fboundp 'coding-system-get)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
13803 (boundp 'buffer-file-coding-system)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
13804 buffer-file-coding-system))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13805 (coding-system-for-write (or coding-system coding-system-for-write))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13806 (save-buffer-coding-system (or coding-system save-buffer-coding-system))
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
13807 (charset (and coding-system
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
13808 (coding-system-get coding-system 'mime-charset)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13809 table-open type
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13810 table-buffer table-orig-buffer
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13811 ind start-is-num starter
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13812 rpl path desc descp desc1 desc2 link
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13813 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13814 (message "Exporting...")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13815
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13816 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13817 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13818
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13819 ;; Get the language-dependent settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13820 (setq lang-words (or (assoc language org-export-language-setup)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13821 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13822
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13823 ;; Switch to the output buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13824 (if (or hidden (not org-export-html-show-new-buffer))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13825 (set-buffer buffer)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13826 (switch-to-buffer-other-window buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13827 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13828 (fundamental-mode)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13829 (let ((case-fold-search nil)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13830 (org-odd-levels-only odd))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13831 ;; create local variables for all options, to make sure all called
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13832 ;; functions get the correct information
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13833 (mapcar (lambda (x)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
13834 (set (make-local-variable (cdr x))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13835 (plist-get opt-plist (car x))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13836 org-export-plist-vars)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13837 (setq umax (if arg (prefix-numeric-value arg)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13838 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13839
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13840 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13841 (insert (format
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13842 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13843 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13844 <html xmlns=\"http://www.w3.org/1999/xhtml\"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13845 lang=\"%s\" xml:lang=\"%s\">
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13846 <head>
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13847 <title>%s</title>
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13848 <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13849 <meta name=\"generator\" content=\"Org-mode\"/>
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13850 <meta name=\"generated\" content=\"%s %s\"/>
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13851 <meta name=\"author\" content=\"%s\"/>
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13852 %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13853 </head><body>
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13854 "
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13855 language language (org-html-expand title) (or charset "iso-8859-1")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13856 date time author style))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13857
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13858
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13859 (insert (or (plist-get opt-plist :preamble) ""))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13860
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13861 (when (plist-get opt-plist :auto-preamble)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13862 (if title (insert (concat "<h1 class=\"title\">"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13863 (org-html-expand title) "</h1>\n")))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13864
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13865 (if text (insert "<p>\n" (org-html-expand text) "</p>")))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13866
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13867 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13868 (progn
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13869 (insert (format "<h2>%s</h2>\n" (nth 3 lang-words)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13870 (insert "<ul>\n<li>")
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13871 (setq lines
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13872 (mapcar '(lambda (line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13873 (if (string-match org-todo-line-regexp line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13874 ;; This is a headline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13875 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13876 (setq level (- (match-end 1) (match-beginning 1))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13877 level (org-tr-level level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13878 txt (save-match-data
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13879 (org-html-expand
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
13880 (org-export-cleanup-toc-line
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13881 (match-string 3 line))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13882 todo
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13883 (or (and org-export-mark-todo-in-toc
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13884 (match-beginning 2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13885 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13886 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13887 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13888 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13889 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13890 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13891 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13892 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13893 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13894 " " txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13895 (if (<= level umax)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13896 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13897 (setq head-count (+ head-count 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13898 (if (> level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13899 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13900 (setq cnt (- level org-last-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13901 (while (>= (setq cnt (1- cnt)) 0)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13902 (insert "\n<ul>\n<li>"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13903 (insert "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13904 (if (< level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13905 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13906 (setq cnt (- org-last-level level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13907 (while (>= (setq cnt (1- cnt)) 0)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13908 (insert "</li>\n</ul>"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13909 (insert "\n")))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13910 ;; Check for targets
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13911 (while (string-match org-target-regexp line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13912 (setq tg (match-string 1 line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13913 line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13914 (concat "@<span class=\"target\">" tg "@</span> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13915 t t line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13916 (push (cons (org-solidify-link-text tg)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13917 (format "sec-%d" head-count))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13918 target-alist))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13919 (while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13920 (setq txt (replace-match "" t t txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13921 (insert
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13922 (format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13923 (if todo
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13924 "</li>\n<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13925 "</li>\n<li><a href=\"#sec-%d\">%s</a>")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13926 head-count txt))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13927
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13928 (setq org-last-level level))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13929 )))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13930 line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13931 lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13932 (while (> org-last-level 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13933 (setq org-last-level (1- org-last-level))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
13934 (insert "</li>\n</ul>\n"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13935 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13936 (setq head-count 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13937 (org-init-section-numbers)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13938
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13939 (while (setq line (pop lines) origline line)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13940 (catch 'nextline
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13941
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13942 ;; end of quote section?
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13943 (when (and inquote (string-match "^\\*+" line))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13944 (insert "</pre>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13945 (setq inquote nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13946 ;; inside a quote section?
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13947 (when inquote
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13948 (insert (org-html-protect line) "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13949 (throw 'nextline nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13950
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13951 ;; verbatim lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13952 (when (and org-export-with-fixed-width
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13953 (string-match "^[ \t]*:\\(.*\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13954 (when (not infixed)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13955 (setq infixed t)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13956 (insert "<pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13957 (insert (org-html-protect (match-string 1 line)) "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13958 (when (and lines
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13959 (not (string-match "^[ \t]*\\(:.*\\)"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13960 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13961 (setq infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13962 (insert "</pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13963 (throw 'nextline nil))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13964
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13965
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13966 ;; make targets to anchors
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13967 (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13968 (cond
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13969 ((match-end 2)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13970 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13971 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13972 (org-solidify-link-text (match-string 1 line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13973 "\">\\nbsp@</a>")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13974 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13975 ((and org-export-with-toc (equal (string-to-char line) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13976 (setq line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13977 (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13978 ; (concat "@<i>" (match-string 1 line) "@</i> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13979 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13980 (t
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13981 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13982 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13983 (org-solidify-link-text (match-string 1 line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13984 "\" class=\"target\">" (match-string 1 line) "@</a> ")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13985 t t line)))))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13986
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13987 (setq line (org-html-handle-time-stamps line))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
13988
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13989 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13990 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
70953
971aad463b69 (org-next-item, org-previous-item): Emit more compact
Carsten Dominik <dominik@science.uva.nl>
parents: 70866
diff changeset
13991 ;; Also handle sub_superscripts and checkboxes
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13992 (setq line (org-html-expand line))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13993
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13994 ;; Format the links
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13995 (setq start 0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13996 (while (string-match org-bracket-link-analytic-regexp line start)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13997 (setq start (match-beginning 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13998 (setq type (if (match-end 2) (match-string 2 line) "internal"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13999 (setq path (match-string 3 line))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14000 (setq desc1 (if (match-end 5) (match-string 5 line))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14001 desc2 (if (match-end 2) (concat type ":" path) path)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14002 descp (and desc1 (not (equal desc1 desc2)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14003 desc (or desc1 desc2))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14004 ;; FIXME: do we need to unescape here somewhere?
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14005 (cond
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14006 ((equal type "internal")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14007 (setq rpl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14008 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14009 "<a href=\"#"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14010 (org-solidify-link-text path target-alist)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14011 "\">" desc "</a>")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14012 ((member type '("http" "https" "ftp" "mailto" "news"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14013 ;; standard URL
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14014 (setq link (concat type ":" path))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14015 (setq rpl (concat "<a href=\"" link "\">" desc "</a>")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14016 ((string= type "file")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14017 ;; FILE link
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14018 (let* ((filename path)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14019 (abs-p (file-name-absolute-p filename))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14020 thefile file-is-image-p search)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14021 (save-match-data
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14022 (if (string-match "::\\(.*\\)" filename)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14023 (setq search (match-string 1 filename)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14024 filename (replace-match "" t nil filename)))
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14025 (setq valid
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14026 (if (functionp link-validate)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14027 (funcall link-validate filename current-dir)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14028 t))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14029 (setq file-is-image-p
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14030 (string-match (org-image-file-name-regexp) filename))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14031 (setq thefile (if abs-p (expand-file-name filename) filename))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14032 (when (and org-export-html-link-org-files-as-html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14033 (string-match "\\.org$" thefile))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14034 (setq thefile (concat (substring thefile 0
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14035 (match-beginning 0))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14036 ".html"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14037 (if (and search
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14038 ;; make sure this is can be used as target search
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14039 (not (string-match "^[0-9]*$" search))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14040 (not (string-match "^\\*" search))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14041 (not (string-match "^/.*/$" search)))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14042 (setq thefile (concat thefile "#"
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14043 (org-solidify-link-text
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14044 (org-link-unescape search)))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14045 (when (string-match "^file:" desc)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14046 (setq desc (replace-match "" t t desc))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14047 (if (string-match "\\.org$" desc)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14048 (setq desc (replace-match "" t t desc))))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14049 (setq rpl (if (and file-is-image-p
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14050 (or (eq t org-export-html-inline-images)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14051 (and org-export-html-inline-images
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14052 (not descp))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14053 (concat "<img src=\"" thefile "\"/>")
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14054 (concat "<a href=\"" thefile "\">" desc "</a>")))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14055 (if (not valid) (setq rpl desc))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14056 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
14057 (setq rpl (concat "<i>&lt;" type ":"
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
14058 (save-match-data (org-link-unescape path))
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
14059 "&gt;</i>"))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14060 (setq line (replace-match rpl t t line)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14061 start (+ start (length rpl))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14062 ;; TODO items
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14063 (if (and (string-match org-todo-line-regexp line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14064 (match-beginning 2))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14065 (if (equal (match-string 2 line) org-done-string)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14066 (setq line (replace-match
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14067 "<span class=\"done\">\\2</span>"
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14068 t nil line 2))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14069 (setq line (replace-match "<span class=\"todo\">\\2</span>"
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14070 t nil line 2))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14071
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14072 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14073 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14074 ;; This is a headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
14075 (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14076 txt (match-string 2 line))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14077 (if (string-match quote-re0 txt)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14078 (setq txt (replace-match "" t t txt)))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14079 (if (<= level umax) (setq head-count (+ head-count 1)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14080 (when in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14081 ;; Close any local lists before inserting a new header line
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14082 (while local-list-num
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14083 (org-close-li)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14084 (insert (if (car local-list-num) "</ol>\n" "</ul>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14085 (pop local-list-num))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14086 (setq local-list-indent nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14087 in-local-list nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14088 (org-html-level-start level txt umax
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14089 (and org-export-with-toc (<= level umax))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14090 head-count)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14091 ;; QUOTES
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14092 (when (string-match quote-re line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14093 (insert "<pre>")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14094 (setq inquote t)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14095
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14096 ((and org-export-with-tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14097 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14098 (if (not table-open)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14099 ;; New table starts
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14100 (setq table-open t table-buffer nil table-orig-buffer nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14101 ;; Accumulate lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14102 (setq table-buffer (cons line table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14103 table-orig-buffer (cons origline table-orig-buffer))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14104 (when (or (not lines)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14105 (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14106 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14107 (setq table-open nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14108 table-buffer (nreverse table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14109 table-orig-buffer (nreverse table-orig-buffer))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14110 (org-close-par-maybe)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14111 (insert (org-format-table-html table-buffer table-orig-buffer))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14112 (t
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14113 ;; Normal lines
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14114 (when (string-match
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14115 (cond
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14116 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14117 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14118 ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14119 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14120 line)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14121 (setq ind (org-get-string-indentation line)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14122 start-is-num (match-beginning 4)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14123 starter (if (match-beginning 2)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14124 (substring (match-string 2 line) 0 -1))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14125 line (substring line (match-beginning 5)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
14126 (unless (string-match "[^ \t]" line)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14127 ;; empty line. Pretend indentation is large.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14128 (setq ind (1+ (or (car local-list-indent) 1))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14129 (while (and in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14130 (or (and (= ind (car local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14131 (not starter))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14132 (< ind (car local-list-indent))))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14133 (org-close-li)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14134 (insert (if (car local-list-num) "</ol>\n" "</ul>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14135 (pop local-list-num) (pop local-list-indent)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14136 (setq in-local-list local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14137 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14138 ((and starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14139 (or (not in-local-list)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14140 (> ind (car local-list-indent))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14141 ;; Start new (level of ) list
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14142 (org-close-par-maybe)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14143 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14144 (push start-is-num local-list-num)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14145 (push ind local-list-indent)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14146 (setq in-local-list t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14147 (starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14148 ;; continue current list
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14149 (org-close-li)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14150 (insert "<li>\n")))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14151 (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14152 (setq line
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14153 (replace-match
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14154 (if (equal (match-string 1 line) "X")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14155 "<b>[X]</b>"
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14156 "<b>[<span style=\"visibility:hidden;\">X</span>]</b>")
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14157 t t line))))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14158
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14159 ;; Empty lines start a new paragraph. If hand-formatted lists
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14160 ;; are not fully interpreted, lines starting with "-", "+", "*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14161 ;; also start a new paragraph.
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14162 (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14163
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14164 ;; Check if the line break needs to be conserved
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14165 (cond
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14166 ((string-match "\\\\\\\\[ \t]*$" line)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14167 (setq line (replace-match "<br/>" t t line)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14168 (org-export-preserve-breaks
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14169 (setq line (concat line "<br/>"))))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14170
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14171 (insert line "\n")))))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14172
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14173 ;; Properly close all local lists and other lists
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14174 (when inquote (insert "</pre>\n"))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14175 (when in-local-list
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14176 ;; Close any local lists before inserting a new header line
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14177 (while local-list-num
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14178 (org-close-li)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14179 (insert (if (car local-list-num) "</ol>\n" "</ul>\n"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14180 (pop local-list-num))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14181 (setq local-list-indent nil
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14182 in-local-list nil))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14183 (org-html-level-start 1 nil umax
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14184 (and org-export-with-toc (<= level umax))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14185 head-count)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14186
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14187 (when (plist-get opt-plist :auto-postamble)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14188 (when author
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14189 (insert "<p class=\"author\"> "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14190 (nth 1 lang-words) ": " author "\n")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14191 (when email
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14192 (insert "<a href=\"mailto:" email "\">&lt;"
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14193 email "&gt;</a>\n"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14194 (insert "</p>\n"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14195 (when (and date time)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14196 (insert "<p class=\"date\"> "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14197 (nth 2 lang-words) ": "
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14198 date " " time "</p>\n")))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14199
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14200 (if org-export-html-with-timestamp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14201 (insert org-export-html-html-helper-timestamp))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14202 (insert (or (plist-get opt-plist :postamble) ""))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14203 (insert "</body>\n</html>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14204 (normal-mode)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14205 ;; remove empty paragraphs and lists
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14206 (goto-char (point-min))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14207 (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14208 (replace-match ""))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14209 (goto-char (point-min))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14210 (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14211 (replace-match ""))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14212 (save-buffer)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14213 (goto-char (point-min))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14214 (message "Exporting... done"))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14215
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14216
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14217 (defun org-format-table-html (lines olines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14218 "Find out which HTML converter to use and return the HTML code."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14219 (if (string-match "^[ \t]*|" (car lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14220 ;; A normal org table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14221 (org-format-org-table-html lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14222 ;; Table made by table.el - test for spanning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14223 (let* ((hlines (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14224 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14225 (if (string-match "^[ \t]*\\+-" x) x
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14226 nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14227 lines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14228 (first (car hlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14229 (ll (and (string-match "\\S-+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14230 (match-string 0 first)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14231 (re (concat "^[ \t]*" (regexp-quote ll)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14232 (spanning (delq nil (mapcar (lambda (x) (not (string-match re x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14233 hlines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14234 (if (and (not spanning)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14235 (not org-export-prefer-native-exporter-for-tables))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14236 ;; We can use my own converter with HTML conversions
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14237 (org-format-table-table-html lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14238 ;; Need to use the code generator in table.el, with the original text.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14239 (org-format-table-table-html-using-table-generate-source olines)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14240
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14241 (defun org-format-org-table-html (lines)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
14242 "Format a table into HTML."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14243 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14244 (setq lines (nreverse lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14245 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14246 (setq lines (nreverse lines))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14247 (when org-export-table-remove-special-lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14248 ;; Check if the table has a marking column. If yes remove the
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14249 ;; column and the special lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14250 (let* ((special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14251 (not
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14252 (memq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14253 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14254 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14255 (or (string-match "^[ \t]*|-" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14256 (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14257 lines)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14258 (if special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14259 (setq lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14260 (delq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14261 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14262 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14263 (if (string-match "^[ \t]*| *[!_^] *|" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14264 nil ; ignore this line
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14265 (and (or (string-match "^[ \t]*|-+\\+" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14266 (string-match "^[ \t]*|[^|]*|" x))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14267 (replace-match "|" t t x))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
14268 lines))))))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
14269
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14270 (let ((head (and org-export-highlight-first-table-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14271 (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14272 (lambda (x) (string-match "^[ \t]*|-" x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14273 (cdr lines)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14274 line fields html)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14275 (setq html (concat org-export-html-table-tag "\n"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
14276 (while (setq line (pop lines))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14277 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14278 (if (string-match "^[ \t]*|-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14279 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14280 (setq head nil) ;; head ends here, first time around
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14281 ;; ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14282 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14283 ;; Break the line into fields
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14284 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14285 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14286 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14287 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14288 (mapconcat (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14289 (if head
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14290 (concat "<th>" x "</th>")
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14291 (concat "<td>" x "</td>")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14292 fields "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14293 "</tr>\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14294 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14295 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14296
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14297 (defun org-fake-empty-table-line (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14298 "Replace everything except \"|\" with spaces."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14299 (let ((i (length line))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14300 (newstr (copy-sequence line)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14301 (while (> i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14302 (setq i (1- i))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14303 (if (not (eq (aref newstr i) ?|))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14304 (aset newstr i ?\ )))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14305 newstr))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14306
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14307 (defun org-format-table-table-html (lines)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
14308 "Format a table generated by table.el into HTML.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14309 This conversion does *not* use `table-generate-source' from table.el.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14310 This has the advantage that Org-mode's HTML conversions can be used.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14311 But it has the disadvantage, that no cell- or row-spanning is allowed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14312 (let (line field-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14313 (head org-export-highlight-first-table-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14314 fields html empty)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14315 (setq html (concat org-export-html-table-tag "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14316 (while (setq line (pop lines))
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14317 (setq empty "&nbsp;")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14318 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14319 (if (string-match "^[ \t]*\\+-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14320 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14321 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14322 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14323 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14324 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14325 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14326 (mapconcat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14327 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14328 (if (equal x "") (setq x empty))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14329 (if head
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14330 (concat "<th>" x "</th>\n")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
14331 (concat "<td>" x "</td>\n")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14332 field-buffer "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14333 "</tr>\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14334 (setq head nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14335 (setq field-buffer nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14336 ;; Ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14337 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14338 ;; Break the line into fields and store the fields
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14339 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14340 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14341 (setq field-buffer (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14342 (lambda (x)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14343 (concat x "<br/>" (pop fields)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14344 field-buffer))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14345 (setq field-buffer fields))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14346 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14347 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14348
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14349 (defun org-format-table-table-html-using-table-generate-source (lines)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14350 "Format a table into html, using `table-generate-source' from table.el.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14351 This has the advantage that cell- or row-spanning is allowed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14352 But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14353 (require 'table)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
14354 (with-current-buffer (get-buffer-create " org-tmp1 ")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14355 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14356 (insert (mapconcat 'identity lines "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14357 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14358 (if (not (re-search-forward "|[^+]" nil t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14359 (error "Error processing table"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14360 (table-recognize-table)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
14361 (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14362 (table-generate-source 'html " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14363 (set-buffer " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14364 (buffer-substring (point-min) (point-max))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14365
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14366 (defun org-html-handle-time-stamps (s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14367 "Format time stamps in string S, or remove them."
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14368 (catch 'exit
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14369 (let (r b)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14370 (while (string-match org-maybe-keyword-time-regexp s)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14371 ;; FIXME: is it good to never export CLOCK, or do we need control?
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14372 (if (and (match-end 1) (equal (match-string 1 s) org-clock-string))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14373 (throw 'exit ""))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14374 (or b (setq b (substring s 0 (match-beginning 0))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14375 (if (not org-export-with-timestamps)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14376 (setq r (concat r (substring s 0 (match-beginning 0)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14377 s (substring s (match-end 0)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14378 (setq r (concat
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14379 r (substring s 0 (match-beginning 0))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14380 (if (match-end 1)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14381 (format "@<span class=\"timestamp-kwd\">%s @</span>"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14382 (match-string 1 s)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14383 (format " @<span class=\"timestamp\">%s@</span>"
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14384 (substring (match-string 3 s) 1 -1)))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14385 s (substring s (match-end 0)))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14386 ;; Line break if line started and ended with time stamp stuff
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14387 (if (not r)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14388 s
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14389 (setq r (concat r s))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14390 (unless (string-match "\\S-" (concat b s))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14391 (setq r (concat r "@<br/>")))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
14392 r))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14393
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14394 (defun org-html-protect (s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14395 ;; convert & to &amp;, < to &lt; and > to &gt;
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14396 (let ((start 0))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14397 (while (string-match "&" s start)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14398 (setq s (replace-match "&amp;" t t s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14399 start (1+ (match-beginning 0))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14400 (while (string-match "<" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14401 (setq s (replace-match "&lt;" t t s)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14402 (while (string-match ">" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14403 (setq s (replace-match "&gt;" t t s))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14404 s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14405
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14406 (defun org-export-cleanup-toc-line (s)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14407 "Remove tags and time staps from lines going into the toc."
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14408 (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14409 (setq s (replace-match "" t t s)))
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14410 (when org-export-remove-timestamps-from-toc
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14411 (while (string-match org-maybe-keyword-time-regexp s)
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
14412 (setq s (replace-match "" t t s))))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14413 s)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14414
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14415 (defun org-html-expand (string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14416 "Prepare STRING for HTML export. Applies all active conversions.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14417 If there are links in the string, don't modify these."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14418 (let* (m s l res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14419 (while (setq m (string-match org-bracket-link-regexp string))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14420 (setq s (substring string 0 m)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14421 l (match-string 0 string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14422 string (substring string (match-end 0)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14423 (push (org-html-do-expand s) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14424 (push l res))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14425 (push (org-html-do-expand string) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14426 (apply 'concat (nreverse res))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14427
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14428 (defun org-html-do-expand (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14429 "Apply all active conversions to translate special ASCII to HTML."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14430 (setq s (org-html-protect s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14431 (if org-export-html-expand
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14432 (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14433 (setq s (replace-match "<\\1>" t nil s))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14434 (if org-export-with-emphasize
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14435 (setq s (org-export-html-convert-emphasize s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14436 (if org-export-with-sub-superscripts
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14437 (setq s (org-export-html-convert-sub-super s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14438 (if org-export-with-TeX-macros
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14439 (let ((start 0) wd ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14440 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14441 (setq wd (match-string 1 s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14442 (if (setq ass (assoc wd org-html-entities))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14443 (setq s (replace-match (or (cdr ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14444 (concat "&" (car ass) ";"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14445 t t s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14446 (setq start (+ start (length wd)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14447 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14448
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14449 (defun org-create-multibrace-regexp (left right n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14450 "Create a regular expression which will match a balanced sexp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14451 Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14452 as single character strings.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14453 The regexp returned will match the entire expression including the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14454 delimiters. It will also define a single group which contains the
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
14455 match except for the outermost delimiters. The maximum depth of
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
14456 stacked delimiters is N. Escaping delimiters is not possible."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14457 (let* ((nothing (concat "[^" "\\" left "\\" right "]*?"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14458 (or "\\|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14459 (re nothing)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14460 (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14461 (while (> n 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14462 (setq n (1- n)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14463 re (concat re or next)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14464 next (concat "\\(?:" nothing left next right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14465 (concat left "\\(" re "\\)" right)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14466
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14467 (defvar org-match-substring-regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14468 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14469 "\\([^\\]\\)\\([_^]\\)\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14470 "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14471 "\\|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14472 "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14473 "\\|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14474 "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14475 "The regular expression matching a sub- or superscript.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14476
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14477 (defun org-export-html-convert-sub-super (string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14478 "Convert sub- and superscripts in STRING to HTML."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14479 (let (key c)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14480 (while (string-match org-match-substring-regexp string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14481 (setq key (if (string= (match-string 2 string) "_") "sub" "sup"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14482 (setq c (or (match-string 8 string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14483 (match-string 6 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14484 (match-string 5 string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14485 (setq string (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14486 (concat (match-string 1 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14487 "<" key ">" c "</" key ">")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14488 t t string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14489 (while (string-match "\\\\\\([_^]\\)" string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14490 (setq string (replace-match (match-string 1 string) t t string))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14491 string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14492
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14493 (defun org-export-html-convert-emphasize (string)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14494 "Apply emphasis."
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14495 (while (string-match org-emph-re string)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14496 (setq string (replace-match (concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist)) "\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist)) "\\5") t nil string)))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
14497 string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14498
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14499 (defvar org-par-open nil)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14500 (defun org-open-par ()
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14501 "Insert <p>, but first close previous paragraph if any."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14502 (org-close-par-maybe)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14503 (insert "\n<p>")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14504 (setq org-par-open t))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14505 (defun org-close-par-maybe ()
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14506 "Close paragraph if there is one open."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14507 (when org-par-open
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14508 (insert "</p>")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14509 (setq org-par-open nil)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14510 (defun org-close-li ()
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14511 "Close <li> if necessary."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14512 (org-close-par-maybe)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14513 (insert "</li>\n"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14514 ; (when (save-excursion
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14515 ; (re-search-backward "</?\\(ul\\|ol\\|li\\|[hH][0-9]\\)>" nil t))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14516 ; (if (member (match-string 0) '("</ul>" "</ol>" "<li>"))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14517 ; (insert "</li>"))))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14518
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14519 (defun org-html-level-start (level title umax with-toc head-count)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14520 "Insert a new level in HTML export.
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14521 When TITLE is nil, just close all open levels."
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14522 (org-close-par-maybe)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14523 (let ((l (1+ (max level umax))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14524 (while (<= l org-level-max)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14525 (if (aref levels-open (1- l))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14526 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14527 (org-html-level-close l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14528 (aset levels-open (1- l) nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14529 (setq l (1+ l)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14530 (when title
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14531 ;; If title is nil, this means this function is called to close
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14532 ;; all levels, so the rest is done only if title is given
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14533 (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14534 (setq title (replace-match
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14535 (if org-export-with-tags
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14536 (save-match-data
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14537 (concat
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14538 "&nbsp;&nbsp;&nbsp;<span class=\"tag\">"
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14539 (mapconcat 'identity (org-split-string
71244
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14540 (match-string 1 title) ":")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14541 "&nbsp;")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14542 "</span>"))
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14543 "")
11ad1dbc7d45 (org-archive-subtree): Use end-of-subtree as insertion
Carsten Dominik <dominik@science.uva.nl>
parents: 71096
diff changeset
14544 t t title)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14545 (if (> level umax)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14546 (progn
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14547 (if (aref levels-open (1- level))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14548 (progn
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14549 (org-close-li)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14550 (insert "<li>" title "<br/>\n"))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14551 (aset levels-open (1- level) t)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14552 (org-close-par-maybe)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14553 (insert "<ul>\n<li>" title "<br/>\n")))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14554 (if org-export-with-section-numbers
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14555 (setq title (concat (org-section-number level) " " title)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14556 (setq level (+ level 1))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14557 (if with-toc
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14558 (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n"
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14559 level head-count title level))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14560 (insert (format "\n<h%d>%s</h%d>\n" level title level)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14561 (org-open-par)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14562
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
14563 (defun org-html-level-close (&rest args)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14564 "Terminate one level in HTML export."
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14565 (org-close-li)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14566 (insert "</ul>"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14567
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14568 ;; Variable holding the vector with section numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14569 (defvar org-section-numbers (make-vector org-level-max 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14570
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14571 (defun org-init-section-numbers ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14572 "Initialize the vector for the section numbers."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14573 (let* ((level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14574 (numbers (nreverse (org-split-string "" "\\.")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14575 (depth (1- (length org-section-numbers)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14576 (i depth) number-string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14577 (while (>= i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14578 (if (> i level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14579 (aset org-section-numbers i 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14580 (setq number-string (or (car numbers) "0"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14581 (if (string-match "\\`[A-Z]\\'" number-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14582 (aset org-section-numbers i
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14583 (- (string-to-char number-string) ?A -1))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
14584 (aset org-section-numbers i (string-to-number number-string)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14585 (pop numbers))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14586 (setq i (1- i)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14587
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14588 (defun org-section-number (&optional level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14589 "Return a string with the current section number.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14590 When LEVEL is non-nil, increase section numbers on that level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14591 (let* ((depth (1- (length org-section-numbers))) idx n (string ""))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14592 (when level
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14593 (when (> level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14594 (aset org-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14595 level (1+ (aref org-section-numbers level))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14596 (setq idx (1+ level))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14597 (while (<= idx depth)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14598 (if (not (= idx 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14599 (aset org-section-numbers idx 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14600 (setq idx (1+ idx))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14601 (setq idx 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14602 (while (<= idx depth)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14603 (setq n (aref org-section-numbers idx))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14604 (setq string (concat string (if (not (string= string "")) "." "")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
14605 (int-to-string n)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14606 (setq idx (1+ idx)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14607 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14608 (if (string-match "\\`\\([@0]\\.\\)+" string)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14609 (setq string (replace-match "" t nil string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14610 (if (string-match "\\(\\.0\\)+\\'" string)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
14611 (setq string (replace-match "" t nil string))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14612 string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14613
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14614
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14615 ;;;###autoload
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14616 (defun org-export-icalendar-this-file ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14617 "Export current file as an iCalendar file.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14618 The iCalendar file will be located in the same directory as the Org-mode
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14619 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14620 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
14621 (org-export-icalendar nil buffer-file-name))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14622
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14623 (defun org-export-as-xoxo-insert-into (buffer &rest output)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14624 (with-current-buffer buffer
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14625 (apply 'insert output)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14626
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14627 (defun org-export-as-xoxo (&optional buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14628 "Export the org buffer as XOXO.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14629 The XOXO buffer is named *xoxo-<source buffer name>*"
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14630 (interactive (list (current-buffer)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14631 ;; A quickie abstraction
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14632
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14633 ;; Output everything as XOXO
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14634 (with-current-buffer (get-buffer buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14635 (goto-char (point-min)) ;; CD: beginning-of-buffer is not allowed.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14636 (let* ((opt-plist (org-combine-plists (org-default-export-plist)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14637 (org-infile-export-plist)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14638 (filename (concat (file-name-as-directory
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14639 (org-export-directory :xoxo opt-plist))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14640 (file-name-sans-extension
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14641 (file-name-nondirectory buffer-file-name))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14642 ".html"))
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14643 (out (find-file-noselect filename))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14644 (last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14645 (hanging-li nil))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14646 ;; Check the output buffer is empty.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14647 (with-current-buffer out (erase-buffer))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14648 ;; Kick off the output
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14649 (org-export-as-xoxo-insert-into out "<ol class='xoxo'>\n")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14650 (while (re-search-forward "^\\(\\*+\\) \\(.+\\)" (point-max) 't)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14651 (let* ((hd (match-string-no-properties 1))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14652 (level (length hd))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14653 (text (concat
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14654 (match-string-no-properties 2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14655 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14656 (goto-char (match-end 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14657 (let ((str ""))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14658 (catch 'loop
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14659 (while 't
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14660 (forward-line)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14661 (if (looking-at "^[ \t]\\(.*\\)")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14662 (setq str (concat str (match-string-no-properties 1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14663 (throw 'loop str)))))))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14664
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14665 ;; Handle level rendering
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14666 (cond
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14667 ((> level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14668 (org-export-as-xoxo-insert-into out "\n<ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14669
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14670 ((< level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14671 (dotimes (- (- last-level level) 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14672 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14673 (org-export-as-xoxo-insert-into out "</li>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14674 (org-export-as-xoxo-insert-into out "</ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14675 (when hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14676 (org-export-as-xoxo-insert-into out "</li>\n")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14677 (setq hanging-li nil)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14678
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14679 ((equal level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14680 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14681 (org-export-as-xoxo-insert-into out "</li>\n")))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14682 )
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14683
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14684 (setq last-level level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14685
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14686 ;; And output the new li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14687 (setq hanging-li 't)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14688 (if (equal ?+ (elt text 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14689 (org-export-as-xoxo-insert-into out "<li class='" (substring text 1) "'>")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14690 (org-export-as-xoxo-insert-into out "<li>" text))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14691
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14692 ;; Finally finish off the ol
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14693 (dotimes (- last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14694 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14695 (org-export-as-xoxo-insert-into out "</li>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14696 (org-export-as-xoxo-insert-into out "</ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14697
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14698 ;; Finish the buffer off and clean it up.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14699 (switch-to-buffer-other-window out)
70162
1f7b0f5ff852 (org-export-as-xoxo): Fix call to `indent-region'.
Carsten Dominik <dominik@science.uva.nl>
parents: 70161
diff changeset
14700 (indent-region (point-min) (point-max) nil)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14701 (save-buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14702 (goto-char (point-min))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14703 )))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
14704
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14705 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14706 (defun org-export-icalendar-all-agenda-files ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14707 "Export all files in `org-agenda-files' to iCalendar .ics files.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14708 Each iCalendar file will be located in the same directory as the Org-mode
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14709 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14710 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14711 (apply 'org-export-icalendar nil (org-agenda-files t)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14712
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14713 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14714 (defun org-export-icalendar-combine-agenda-files ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14715 "Export all files in `org-agenda-files' to a single combined iCalendar file.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14716 The file is stored under the name `org-combined-agenda-icalendar-file'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14717 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
14718 (apply 'org-export-icalendar t (org-agenda-files t)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14719
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14720 (defun org-export-icalendar (combine &rest files)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14721 "Create iCalendar files for all elements of FILES.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14722 If COMBINE is non-nil, combine all calendar entries into a single large
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14723 file and store it under the name `org-combined-agenda-icalendar-file'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14724 (save-excursion
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14725 (let* ((dir (org-export-directory
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14726 :ical (list :publishing-directory
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14727 org-export-publishing-directory)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14728 file ical-file ical-buffer category started org-agenda-new-buffers)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14729
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14730 (when combine
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14731 (setq ical-file
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14732 (if (file-name-absolute-p org-combined-agenda-icalendar-file)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14733 org-combined-agenda-icalendar-file
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14734 (expand-file-name org-combined-agenda-icalendar-file dir))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14735 ical-buffer (org-get-agenda-file-buffer ical-file))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14736 (set-buffer ical-buffer) (erase-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14737 (while (setq file (pop files))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14738 (catch 'nextfile
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14739 (org-check-agenda-file file)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14740 (set-buffer (org-get-agenda-file-buffer file))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14741 (unless combine
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14742 (setq ical-file (concat (file-name-as-directory dir)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
14743 (file-name-sans-extension
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14744 (file-name-nondirectory buffer-file-name))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14745 ".ics"))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14746 (setq ical-buffer (org-get-agenda-file-buffer ical-file))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
14747 (with-current-buffer ical-buffer (erase-buffer)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14748 (setq category (or org-category
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14749 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
14750 (file-name-nondirectory buffer-file-name))))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14751 (if (symbolp category) (setq category (symbol-name category)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14752 (let ((standard-output ical-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14753 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14754 (and (not started) (setq started t)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14755 (org-start-icalendar-file org-icalendar-combined-name))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14756 (org-start-icalendar-file category))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14757 (org-print-icalendar-entries combine category)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14758 (when (or (and combine (not files)) (not combine))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14759 (org-finish-icalendar-file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14760 (set-buffer ical-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14761 (save-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14762 (run-hooks 'org-after-save-iCalendar-file-hook)))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14763 (org-release-buffers org-agenda-new-buffers))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14764
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14765 (defvar org-after-save-iCalendar-file-hook nil
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14766 "Hook run after an iCalendar file has been saved.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14767 The iCalendar buffer is still current when this hook is run.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14768 A good way to use this is to tell a desktop calenndar application to re-read
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14769 the iCalendar file.")
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14770
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14771 (defun org-print-icalendar-entries (&optional combine category)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14772 "Print iCalendar entries for the current Org-mode file to `standard-output'.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14773 When COMBINE is non nil, add the category to each line."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14774 (let ((re2 (concat "--?-?\\(" org-ts-regexp "\\)"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14775 (dts (org-ical-ts-to-string
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14776 (format-time-string (cdr org-time-stamp-formats) (current-time))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14777 "DTSTART"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
14778 hd ts ts2 state (inc t) pos scheduledp deadlinep tmp pri)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14779 (save-excursion
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14780 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14781 (while (re-search-forward org-ts-regexp nil t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14782 (setq pos (match-beginning 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14783 ts (match-string 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14784 inc t
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14785 hd (org-get-heading))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14786 (if (looking-at re2)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14787 (progn
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14788 (goto-char (match-end 0))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14789 (setq ts2 (match-string 1) inc nil))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14790 (setq ts2 ts
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14791 tmp (buffer-substring (max (point-min)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14792 (- pos org-ds-keyword-length))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14793 pos)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14794 deadlinep (string-match org-deadline-regexp tmp)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14795 scheduledp (string-match org-scheduled-regexp tmp)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
14796 ;; donep (org-entry-is-done-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
14797 ))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14798 (if (or (string-match org-tr-regexp hd)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14799 (string-match org-ts-regexp hd))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
14800 (setq hd (replace-match "" t t hd)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14801 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14802 (setq hd (concat hd " (category " category ")")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14803 (if deadlinep (setq hd (concat "DL: " hd " This is a deadline")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14804 (if scheduledp (setq hd (concat "S: " hd " Scheduled for this date")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14805 (princ (format "BEGIN:VEVENT
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14806 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14807 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14808 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14809 END:VEVENT\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14810 (org-ical-ts-to-string ts "DTSTART")
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14811 (org-ical-ts-to-string ts2 "DTEND" inc)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14812 hd)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14813 (when org-icalendar-include-todo
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14814 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14815 (while (re-search-forward org-todo-line-regexp nil t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14816 (setq state (match-string 1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14817 (unless (equal state org-done-string)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14818 (setq hd (match-string 3))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14819 (if (string-match org-priority-regexp hd)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14820 (setq pri (string-to-char (match-string 2 hd))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14821 hd (concat (substring hd 0 (match-beginning 1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14822 (substring hd (- (match-end 1)))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14823 (setq pri org-default-priority))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14824 (setq pri (floor (1+ (* 8. (/ (float (- org-lowest-priority pri))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14825 (- org-lowest-priority ?A))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14826
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14827 (princ (format "BEGIN:VTODO
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14828 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14829 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14830 SEQUENCE:1
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14831 PRIORITY:%d
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14832 END:VTODO\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14833 dts hd pri))))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14834
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14835 (defun org-start-icalendar-file (name)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14836 "Start an iCalendar file by inserting the header."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14837 (let ((user user-full-name)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14838 (name (or name "unknown"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
14839 (timezone (cadr (current-time-zone))))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14840 (princ
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14841 (format "BEGIN:VCALENDAR
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14842 VERSION:2.0
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14843 X-WR-CALNAME:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14844 PRODID:-//%s//Emacs with Org-mode//EN
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
14845 X-WR-TIMEZONE:%s
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14846 CALSCALE:GREGORIAN\n" name user timezone))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14847
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14848 (defun org-finish-icalendar-file ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14849 "Finish an iCalendar file by inserting the END statement."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14850 (princ "END:VCALENDAR\n"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14851
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14852 (defun org-ical-ts-to-string (s keyword &optional inc)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14853 "Take a time string S and convert it to iCalendar format.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14854 KEYWORD is added in front, to make a complete line like DTSTART....
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14855 When INC is non-nil, increase the hour by two (if time string contains
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14856 a time), or the day by one (if it does not contain a time)."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14857 (let ((t1 (org-parse-time-string s 'nodefault))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14858 t2 fmt have-time time)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14859 (if (and (car t1) (nth 1 t1) (nth 2 t1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14860 (setq t2 t1 have-time t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14861 (setq t2 (org-parse-time-string s)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14862 (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14863 (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14864 (when inc
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14865 (if have-time (setq h (+ 2 h)) (setq d (1+ d))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14866 (setq time (encode-time s mi h d m y)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14867 (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14868 (concat keyword (format-time-string fmt time))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
14869
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14870 ;;; LaTeX stuff
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14871
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14872 (defvar org-cdlatex-mode-map (make-sparse-keymap)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14873 "Keymap for the minor `org-cdlatex-mode'.")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14874
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14875 (define-key org-cdlatex-mode-map "_" 'org-cdlatex-underscore-caret)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14876 (define-key org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14877 (define-key org-cdlatex-mode-map "`" 'cdlatex-math-symbol)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14878 (define-key org-cdlatex-mode-map "'" 'org-cdlatex-math-modify)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14879 (define-key org-cdlatex-mode-map "\C-c{" 'cdlatex-environment)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14880
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14881 (defvar org-cdlatex-texmathp-advice-is-done nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14882 "Flag remembering if we have applied the advice to texmathp already.")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14883
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14884 (define-minor-mode org-cdlatex-mode
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14885 "Toggle the minor `org-cdlatex-mode'.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14886 This mode supports entering LaTeX environment and math in LaTeX fragments
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14887 in Org-mode.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14888 \\{org-cdlatex-mode-map}"
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14889 nil " OCDL" nil
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14890 (when org-cdlatex-mode (require 'cdlatex))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14891 (unless org-cdlatex-texmathp-advice-is-done
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14892 (setq org-cdlatex-texmathp-advice-is-done t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14893 (defadvice texmathp (around org-math-always-on activate)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14894 "Always return t in org-mode buffers.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14895 This is because we want to insert math symbols without dollars even outside
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14896 the LaTeX math segments. If Orgmode thinks that point is actually inside
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14897 en embedded LaTeX fragement, let texmathp do its job.
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14898 \\[org-cdlatex-mode-map]"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14899 (interactive)
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14900 (let (p)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14901 (cond
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
14902 ((not (org-mode-p)) ad-do-it)
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14903 ((eq this-command 'cdlatex-math-symbol)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14904 (setq ad-return-value t
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14905 texmathp-why '("cdlatex-math-symbol in org-mode" . 0)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14906 (t
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14907 (let ((p (org-inside-LaTeX-fragment-p)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14908 (if (and p (member (car p) (plist-get org-format-latex-options :matchers)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14909 (setq ad-return-value t
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14910 texmathp-why '("Org-mode embedded math" . 0))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14911 (if p ad-do-it)))))))))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14912
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14913 (defun turn-on-org-cdlatex ()
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14914 "Unconditionally turn on `org-cdlatex-mode'."
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14915 (org-cdlatex-mode 1))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14916
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14917 (defun org-inside-LaTeX-fragment-p ()
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14918 "Test if point is inside a LaTeX fragment.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14919 I.e. after a \\begin, \\(, \\[, $, or $$, without the corresponding closing
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14920 sequence appearing also before point.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14921 Even though the matchers for math are configurable, this function assumes
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14922 that \\begin, \\(, \\[, and $$ are always used. Only the single dollar
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14923 delimiters are skipped when they have been removed by customization.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14924 The return value is nil, or a cons cell with the delimiter and
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14925 and the position of this delimiter.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14926
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14927 This function does a reasonably good job, but can locally be fooled by
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14928 for example currency specifications. For example it will assume being in
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14929 inline math after \"$22.34\". The LaTeX fragment formatter will only format
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14930 fragments that are properly closed, but during editing, we have to live
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14931 with the uncertainty caused by missing closing delimiters. This function
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14932 looks only before point, not after."
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14933 (catch 'exit
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14934 (let ((pos (point))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14935 (dodollar (member "$" (plist-get org-format-latex-options :matchers)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14936 (lim (progn
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14937 (re-search-backward (concat "^\\(" paragraph-start "\\)") nil t)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14938 (point)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14939 dd-on str (start 0) m re)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14940 (goto-char pos)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14941 (when dodollar
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14942 (setq str (concat (buffer-substring lim (point)) "\000 X$.")
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14943 re (nth 1 (assoc "$" org-latex-regexps)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14944 (while (string-match re str start)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14945 (cond
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14946 ((= (match-end 0) (length str))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14947 (throw 'exit (cons "$" (+ lim (match-beginning 0)))))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14948 ((= (match-end 0) (- (length str) 5))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14949 (throw 'exit nil))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14950 (t (setq start (match-end 0))))))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14951 (when (setq m (re-search-backward "\\(\\\\begin{[^}]*}\\|\\\\(\\|\\\\\\[\\)\\|\\(\\\\end{[^}]*}\\|\\\\)\\|\\\\\\]\\)\\|\\(\\$\\$\\)" lim t))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14952 (goto-char pos)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14953 (and (match-beginning 1) (throw 'exit (cons (match-string 1) m)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14954 (and (match-beginning 2) (throw 'exit nil))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14955 ;; count $$
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14956 (while (re-search-backward "\\$\\$" lim t)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14957 (setq dd-on (not dd-on)))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14958 (goto-char pos)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14959 (if dd-on (cons "$$" m))))))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
14960
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14961
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14962 (defun org-try-cdlatex-tab ()
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14963 "Check if it makes sense to execute `cdlatex-tab', and do it if yes.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14964 It makes sense to do so if `org-cdlatex-mode' is active and if the cursor is
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14965 - inside a LaTeX fragment, or
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14966 - after the first word in a line, where an abbreviation expansion could
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14967 insert a LaTeX environment."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14968 ;; FIXME: This may still need refinement.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14969 (when org-cdlatex-mode
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14970 (cond
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14971 ((save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14972 (skip-chars-backward "a-zA-Z0-9*")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14973 (skip-chars-backward " \t")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14974 (bolp))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14975 (cdlatex-tab) t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14976 ((org-inside-LaTeX-fragment-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14977 (cdlatex-tab) t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14978 (t nil))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14979
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14980 (defun org-cdlatex-underscore-caret (&optional arg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14981 "Execute `cdlatex-sub-superscript' in LaTeX fragments.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14982 Revert to the normal definition outside of these fragments."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14983 (interactive "P")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14984 (if (org-inside-LaTeX-fragment-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14985 (call-interactively 'cdlatex-sub-superscript)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14986 (let (org-cdlatex-mode)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14987 (call-interactively (key-binding (vector last-input-event))))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14988
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14989 (defun org-cdlatex-math-modify (&optional arg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14990 "Execute `cdlatex-math-modify' in LaTeX fragments.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14991 Revert to the normal definition outside of these fragments."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14992 (interactive "P")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14993 (if (org-inside-LaTeX-fragment-p)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14994 (call-interactively 'cdlatex-math-modify)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14995 (let (org-cdlatex-mode)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14996 (call-interactively (key-binding (vector last-input-event))))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14997
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14998 (defvar org-latex-fragment-image-overlays nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
14999 "List of overlays carrying the images of latex fragments.")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15000 (make-variable-buffer-local 'org-latex-fragment-image-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15001
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15002 (defun org-remove-latex-fragment-image-overlays ()
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15003 "Remove all overlays with LaTeX fragment images in current buffer."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15004 (mapc 'org-delete-overlay org-latex-fragment-image-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15005 (setq org-latex-fragment-image-overlays nil))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15006
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15007 (defun org-preview-latex-fragment (&optional subtree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15008 "Preview the LaTeX fragment at point, or all locally or globally.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15009 If the cursor is in a LaTeX fragment, create the image and overlay
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15010 it over the source code. If there is no fragment at point, display
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15011 all fragments in the current text, from one headline to the next. With
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15012 prefix SUBTREE, display all fragments in the current subtree. With a
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15013 double prefix `C-u C-u', or when the cursor is before the first headline,
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15014 display all fragments in the buffer.
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15015 The images can be removed again with \\[org-ctrl-c-ctrl-c]."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15016 (interactive "P")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15017 (org-remove-latex-fragment-image-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15018 (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15019 (save-restriction
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15020 (let (beg end at msg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15021 (cond
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15022 ((or (equal subtree '(16))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15023 (not (save-excursion
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15024 (re-search-backward (concat "^" outline-regexp) nil t))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15025 (setq beg (point-min) end (point-max)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15026 msg "Creating images for buffer...%s"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15027 ((equal subtree '(4))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15028 (org-back-to-heading)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15029 (setq beg (point) end (org-end-of-subtree)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15030 msg "Creating images for subtree...%s"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15031 (t
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15032 (if (setq at (org-inside-LaTeX-fragment-p))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15033 (goto-char (max (point-min) (- (cdr at) 2)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15034 (org-back-to-heading))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15035 (setq beg (point) end (progn (outline-next-heading) (point))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15036 msg (if at "Creating image...%s"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15037 "Creating images for entry...%s"))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15038 (message msg "")
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15039 (narrow-to-region beg end)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15040 (org-format-latex
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15041 (concat "ltxpng/" (file-name-sans-extension
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15042 (file-name-nondirectory
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15043 buffer-file-name)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15044 default-directory 'overlays msg at)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15045 (message msg "done. Use `C-c C-c' to remove images.")))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15046
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15047 (defvar org-latex-regexps
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15048 '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15049 ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15050 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15051 ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([ .,?;:'\")\000]\\|$\\)" 2 nil)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15052 ("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15053 ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 t)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15054 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 t))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15055 "Regular expressions for matching embedded LaTeX.")
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15056
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15057 (defun org-format-latex (prefix &optional dir overlays msg at)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15058 "Replace LaTeX fragments with links to an image, and produce images."
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15059 (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15060 (let* ((prefixnodir (file-name-nondirectory prefix))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15061 (absprefix (expand-file-name prefix dir))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15062 (todir (file-name-directory absprefix))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15063 (opt org-format-latex-options)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15064 (matchers (plist-get opt :matchers))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15065 (re-list org-latex-regexps)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15066 (cnt 0) txt link beg end re e oldfiles
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15067 m n block linkfile movefile ov)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15068 ;; Make sure the directory exists
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15069 (or (file-directory-p todir) (make-directory todir))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15070 ;; Check if there are old images files with this prefix, and remove them
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15071 (setq oldfiles (directory-files
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15072 todir 'full
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15073 (concat (regexp-quote prefixnodir) "_[0-9]+\\.png$")))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15074 (while oldfiles (delete-file (pop oldfiles)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15075 ;; Check the different regular expressions
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15076 (while (setq e (pop re-list))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15077 (setq m (car e) re (nth 1 e) n (nth 2 e)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15078 block (if (nth 3 e) "\n\n" ""))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15079 (when (member m matchers)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15080 (goto-char (point-min))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15081 (while (re-search-forward re nil t)
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15082 (when (or (not at) (equal (cdr at) (match-beginning n)))
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15083 (setq txt (match-string n)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15084 beg (match-beginning n) end (match-end n)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15085 cnt (1+ cnt)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15086 linkfile (format "%s_%04d.png" prefix cnt)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15087 movefile (format "%s_%04d.png" absprefix cnt)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15088 link (concat block "[[file:" linkfile "]]" block))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15089 (if msg (message msg cnt))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15090 (goto-char beg)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15091 (org-create-formula-image
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15092 txt movefile opt)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15093 (if overlays
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15094 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15095 (setq ov (org-make-overlay beg end))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15096 (if (featurep 'xemacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15097 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15098 (org-overlay-put ov 'invisible t)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15099 (org-overlay-put
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15100 ov 'end-glyph
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15101 (make-glyph (vector 'png :file movefile))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15102 (org-overlay-put
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15103 ov 'display
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15104 (list 'image :type 'png :file movefile :ascent 'center)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15105 (push ov org-latex-fragment-image-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15106 (goto-char end))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15107 (delete-region beg end)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15108 (insert link))))))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15109
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15110 ;; This function borrows from Ganesh Swami's latex2png.el
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15111 (defun org-create-formula-image (string tofile options)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15112 (let* ((tmpdir (if (featurep 'xemacs)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15113 (temp-directory)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15114 temporary-file-directory))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15115 (texfilebase (make-temp-name
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15116 (expand-file-name "orgtex" tmpdir)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15117
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15118 ;(texfilebase (make-temp-file "orgtex"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15119 ; (dummy (delete-file texfilebase))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15120 (texfile (concat texfilebase ".tex"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15121 (dvifile (concat texfilebase ".dvi"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15122 (pngfile (concat texfilebase ".png"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15123 (scale (number-to-string (* 1000 (or (plist-get options :scale) 1.0))))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15124 (fg (or (plist-get options :foreground) "Black"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15125 (bg (or (plist-get options :background) "Transparent")))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15126 (with-temp-file texfile
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15127 (insert "\\documentclass{article}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15128 \\usepackage{fullpage}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15129 \\usepackage{amssymb}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15130 \\usepackage[usenames]{color}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15131 \\usepackage{amsmath}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15132 \\usepackage{latexsym}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15133 \\usepackage[mathscr]{eucal}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15134 \\pagestyle{empty}
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15135 \\begin{document}\n" string "\n\\end{document}\n"))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15136 (let ((dir default-directory))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15137 (condition-case nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15138 (progn
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15139 (cd tmpdir)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15140 (call-process "latex" nil nil nil texfile))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15141 (error nil))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15142 (cd dir))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15143 (if (not (file-exists-p dvifile))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15144 (progn (message "Failed to create dvi file from %s" texfile) nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15145 (call-process "dvipng" nil nil nil
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15146 "-E" "-fg" fg "-bg" bg
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15147 "-x" scale "-y" scale "-T" "tight"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15148 "-o" pngfile
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15149 dvifile)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15150 (if (not (file-exists-p pngfile))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15151 (progn (message "Failed to create png file from %s" texfile) nil)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15152 ;; Use the requested file name and clean up
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15153 (copy-file pngfile tofile 'replace)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15154 (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15155 (delete-file (concat texfilebase e)))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15156 pngfile))))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
15157
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15158 ;;; Key bindings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15159
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15160 ;; - Bindings in Org-mode map are currently
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15161 ;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
15162 ;; abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/= [] ; |,.<>~ '\t necessary bindings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15163 ;; e (?) useful from outline-mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15164 ;; i k @ expendable from outline-mode
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
15165 ;; 0123456789 % & ()_{} " ` free
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15166
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
15167 ;; Make `C-c C-x' a prefix key
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
15168 (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
15169
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15170 ;; TAB key with modifiers
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15171 (define-key org-mode-map "\C-i" 'org-cycle)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
15172 (define-key org-mode-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15173 (define-key org-mode-map [(meta tab)] 'org-complete)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15174 (define-key org-mode-map "\M-\C-i" 'org-complete) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15175 ;; The following line is necessary under Suse GNU/Linux
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15176 (unless (featurep 'xemacs)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15177 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15178 (define-key org-mode-map [(shift tab)] 'org-shifttab)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15179
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15180 (define-key org-mode-map (org-key 'S-return) 'org-table-copy-down)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15181 (define-key org-mode-map "\C-c\C-xc" 'org-table-copy-down) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15182 (define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15183 (define-key org-mode-map "\C-c\C-xM" 'org-insert-todo-heading) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15184 (define-key org-mode-map [(meta return)] 'org-meta-return)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15185 (define-key org-mode-map "\C-c\C-xm" 'org-meta-return) ; tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15186 (define-key org-mode-map [?\e (return)] 'org-meta-return) ; tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15187
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15188 ;; Cursor keys with modifiers
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15189 (define-key org-mode-map [(meta left)] 'org-metaleft)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15190 (define-key org-mode-map [?\e (left)] 'org-metaleft) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15191 (define-key org-mode-map "\C-c\C-xl" 'org-metaleft) ; for tty emacs
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15192 (define-key org-mode-map [(meta right)] 'org-metaright)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15193 (define-key org-mode-map [?\e (right)] 'org-metaright) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15194 (define-key org-mode-map "\C-c\C-xr" 'org-metaright) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15195 (define-key org-mode-map [(meta up)] 'org-metaup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15196 (define-key org-mode-map [?\e (up)] 'org-metaup) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15197 (define-key org-mode-map "\C-c\C-xu" 'org-metaup) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15198 (define-key org-mode-map [(meta down)] 'org-metadown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15199 (define-key org-mode-map [?\e (down)] 'org-metadown) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15200 (define-key org-mode-map "\C-c\C-xd" 'org-metadown) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15201
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15202 (define-key org-mode-map [(meta shift left)] 'org-shiftmetaleft)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15203 (define-key org-mode-map "\C-c\C-xL" 'org-shiftmetaleft) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15204 (define-key org-mode-map [(meta shift right)] 'org-shiftmetaright)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15205 (define-key org-mode-map "\C-c\C-xR" 'org-shiftmetaright) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15206 (define-key org-mode-map [(meta shift up)] 'org-shiftmetaup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15207 (define-key org-mode-map "\C-c\C-xU" 'org-shiftmetaup) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15208 (define-key org-mode-map [(meta shift down)] 'org-shiftmetadown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15209 (define-key org-mode-map "\C-c\C-xD" 'org-shiftmetadown) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15210 (define-key org-mode-map (org-key 'S-up) 'org-shiftup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15211 (define-key org-mode-map [?\C-c ?\C-x (up)] 'org-shiftup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15212 (define-key org-mode-map (org-key 'S-down) 'org-shiftdown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15213 (define-key org-mode-map [?\C-c ?\C-x (down)] 'org-shiftdown)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15214 (define-key org-mode-map (org-key 'S-left) 'org-shiftleft)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15215 (define-key org-mode-map [?\C-c ?\C-x (left)] 'org-shiftleft)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15216 (define-key org-mode-map (org-key 'S-right) 'org-shiftright)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15217 (define-key org-mode-map [?\C-c ?\C-x (right)] 'org-shiftright)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15218
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15219 ;; All the other keys
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
15220
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
15221 (define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up.
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
15222 (define-key org-mode-map "\C-xns" 'org-narrow-to-subtree)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
15223 (define-key org-mode-map "\C-c$" 'org-archive-subtree)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15224 (define-key org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15225 (define-key org-mode-map "\C-c\C-j" 'org-goto)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15226 (define-key org-mode-map "\C-c\C-t" 'org-todo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15227 (define-key org-mode-map "\C-c\C-s" 'org-schedule)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15228 (define-key org-mode-map "\C-c\C-d" 'org-deadline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15229 (define-key org-mode-map "\C-c;" 'org-toggle-comment)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15230 (define-key org-mode-map "\C-c\C-v" 'org-show-todo-tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15231 (define-key org-mode-map "\C-c\C-w" 'org-check-deadlines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15232 (define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
15233 (define-key org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15234 (define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15235 (define-key org-mode-map "\M-\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15236 (define-key org-mode-map "\C-c\C-l" 'org-insert-link)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15237 (define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
15238 (define-key org-mode-map "\C-c%" 'org-mark-ring-push)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
15239 (define-key org-mode-map "\C-c&" 'org-mark-ring-goto)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15240 (define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15241 (define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15242 (define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15243 (define-key org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15244 (define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15245 (define-key org-mode-map "\C-c>" 'org-goto-calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15246 (define-key org-mode-map "\C-c<" 'org-date-from-calendar)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
15247 (define-key org-mode-map [(control ?,)] 'org-cycle-agenda-files)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
15248 (define-key org-mode-map "\C-c[" 'org-agenda-file-to-front)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15249 (define-key org-mode-map "\C-c]" 'org-remove-file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15250 (define-key org-mode-map "\C-c\C-r" 'org-timeline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15251 (define-key org-mode-map "\C-c-" 'org-table-insert-hline)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
15252 (define-key org-mode-map "\C-c^" 'org-table-sort-lines)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15253 (define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
15254 (define-key org-mode-map "\C-m" 'org-return)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15255 (define-key org-mode-map "\C-c?" 'org-table-current-column)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15256 (define-key org-mode-map "\C-c " 'org-table-blank-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15257 (define-key org-mode-map "\C-c+" 'org-table-sum)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15258 (define-key org-mode-map "\C-c=" 'org-table-eval-formula)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15259 (define-key org-mode-map "\C-c'" 'org-table-edit-formulas)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15260 (define-key org-mode-map "\C-c`" 'org-table-edit-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15261 (define-key org-mode-map "\C-c|" 'org-table-create-or-convert-from-region)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15262 (define-key org-mode-map "\C-c*" 'org-table-recalculate)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15263 (define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15264 (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15265 (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15266 (define-key org-mode-map "\C-c\C-e" 'org-export)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15267 (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15268
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
15269 (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15270 (define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15271 (define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15272 (define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15273
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15274 (define-key org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15275 (define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15276 (define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15277 (define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
15278 (define-key org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
15279 (define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15280 (define-key org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
15281 (define-key org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15282
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15283 (when (featurep 'xemacs)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15284 (define-key org-mode-map 'button3 'popup-mode-menu))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15285
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15286 (defsubst org-table-p () (org-at-table-p))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15287
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15288 (defun org-self-insert-command (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15289 "Like `self-insert-command', use overwrite-mode for whitespace in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15290 If the cursor is in a table looking at whitespace, the whitespace is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15291 overwritten, and the table is not marked as requiring realignment."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15292 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15293 (if (and (org-table-p)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15294 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15295 ;; check if we blank the field, and if that triggers align
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15296 (and org-table-auto-blank-field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15297 (member last-command
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15298 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15299 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15300 ;; got extra space, this field does not determine column width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15301 (let (org-table-may-need-update) (org-table-blank-field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15302 ;; no extra space, this field may determine column width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15303 (org-table-blank-field)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15304 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15305 (eq N 1)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15306 (looking-at "[^|\n]* |"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15307 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15308 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15309 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15310 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15311 (self-insert-command N))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15312 (setq org-table-may-need-update t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15313 (self-insert-command N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15314
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15315 (defun org-delete-backward-char (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15316 "Like `delete-backward-char', insert whitespace at field end in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15317 When deleting backwards, in tables this function will insert whitespace in
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15318 front of the next \"|\" separator, to keep the table aligned. The table will
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15319 still be marked for re-alignment if the field did fill the entire column,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15320 because, in this case the deletion might narrow the column."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15321 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15322 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15323 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15324 (string-match "|" (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15325 (looking-at ".*?|"))
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15326 (let ((pos (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15327 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15328 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15329 (backward-delete-char N)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15330 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15331 (insert " ")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15332 (goto-char (1- pos))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15333 ;; noalign: if there were two spaces at the end, this field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15334 ;; does not determine the width of the column.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15335 (if noalign (setq org-table-may-need-update c)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15336 (backward-delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15337
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15338 (defun org-delete-char (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15339 "Like `delete-char', but insert whitespace at field end in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15340 When deleting characters, in tables this function will insert whitespace in
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15341 front of the next \"|\" separator, to keep the table aligned. The table will
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15342 still be marked for re-alignment if the field did fill the entire column,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15343 because, in this case the deletion might narrow the column."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15344 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15345 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15346 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15347 (not (= (char-after) ?|))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15348 (eq N 1))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15349 (if (looking-at ".*?|")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15350 (let ((pos (point))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15351 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15352 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15353 (replace-match (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15354 (substring (match-string 0) 1 -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15355 " |"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15356 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15357 ;; noalign: if there were two spaces at the end, this field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15358 ;; does not determine the width of the column.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15359 (if noalign (setq org-table-may-need-update c)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15360 (delete-char N))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15361 (delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15362
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15363 ;; How to do this: Measure non-white length of current string
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15364 ;; If equal to column width, we should realign.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15365
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15366 (defun org-remap (map &rest commands)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15367 "In MAP, remap the functions given in COMMANDS.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15368 COMMANDS is a list of alternating OLDDEF NEWDEF command names."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15369 (let (new old)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15370 (while commands
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15371 (setq old (pop commands) new (pop commands))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15372 (if (fboundp 'command-remapping)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15373 (define-key map (vector 'remap old) new)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15374 (substitute-key-definition old new map global-map)))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
15375
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15376 (when (eq org-enable-table-editor 'optimized)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15377 ;; If the user wants maximum table support, we need to hijack
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15378 ;; some standard editing functions
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15379 (org-remap org-mode-map
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15380 'self-insert-command 'org-self-insert-command
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15381 'delete-char 'org-delete-char
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15382 'delete-backward-char 'org-delete-backward-char)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15383 (define-key org-mode-map "|" 'org-force-self-insert))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15384
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15385 (defun org-shiftcursor-error ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15386 "Throw an error because Shift-Cursor command was applied in wrong context."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15387 (error "This command is active in special context like tables, headlines or timestamps"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15388
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15389 (defun org-shifttab (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15390 "Global visibility cycling or move to previous table field.
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15391 Calls `org-cycle' with argument t, or `org-table-previous-field', depending
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15392 on context.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15393 See the individual commands for more information."
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15394 (interactive "P")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15395 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15396 ((org-at-table-p) (call-interactively 'org-table-previous-field))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15397 (t (call-interactively 'org-global-cycle))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15398
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15399 (defun org-shiftmetaleft ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15400 "Promote subtree or delete table column.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15401 Calls `org-promote-subtree' or `org-table-delete-column', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15402 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15403 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15404 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15405 ((org-at-table-p) (call-interactively 'org-table-delete-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15406 ((org-on-heading-p) (call-interactively 'org-promote-subtree))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15407 ((org-at-item-p) (call-interactively 'org-outdent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15408 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15409
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15410 (defun org-shiftmetaright ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15411 "Demote subtree or insert table column.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15412 Calls `org-demote-subtree' or `org-table-insert-column', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15413 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15414 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15415 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15416 ((org-at-table-p) (call-interactively 'org-table-insert-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15417 ((org-on-heading-p) (call-interactively 'org-demote-subtree))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15418 ((org-at-item-p) (call-interactively 'org-indent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15419 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15420
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15421 (defun org-shiftmetaup (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15422 "Move subtree up or kill table row.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15423 Calls `org-move-subtree-up' or `org-table-kill-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15424 `org-move-item-up' depending on context. See the individual commands
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15425 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15426 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15427 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15428 ((org-at-table-p) (call-interactively 'org-table-kill-row))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15429 ((org-on-heading-p) (call-interactively 'org-move-subtree-up))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15430 ((org-at-item-p) (call-interactively 'org-move-item-up))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15431 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15432 (defun org-shiftmetadown (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15433 "Move subtree down or insert table row.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15434 Calls `org-move-subtree-down' or `org-table-insert-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15435 `org-move-item-down', depending on context. See the individual
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15436 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15437 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15438 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15439 ((org-at-table-p) (call-interactively 'org-table-insert-row))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15440 ((org-on-heading-p) (call-interactively 'org-move-subtree-down))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15441 ((org-at-item-p) (call-interactively 'org-move-item-down))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15442 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15443
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15444 (defun org-metaleft (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15445 "Promote heading or move table column to left.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15446 Calls `org-do-promote' or `org-table-move-column', depending on context.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15447 With no specific context, calls the Emacs default `backward-word'.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15448 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15449 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15450 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15451 ((org-at-table-p) (org-call-with-arg 'org-table-move-column 'left))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15452 ((or (org-on-heading-p) (org-region-active-p))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15453 (call-interactively 'org-do-promote))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15454 (t (call-interactively 'backward-word))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15455
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15456 (defun org-metaright (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15457 "Demote subtree or move table column to right.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15458 Calls `org-do-demote' or `org-table-move-column', depending on context.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15459 With no specific context, calls the Emacs default `forward-word'.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15460 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15461 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15462 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15463 ((org-at-table-p) (call-interactively 'org-table-move-column))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15464 ((or (org-on-heading-p) (org-region-active-p))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15465 (call-interactively 'org-do-demote))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15466 (t (call-interactively 'forward-word))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15467
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15468 (defun org-metaup (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15469 "Move subtree up or move table row up.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15470 Calls `org-move-subtree-up' or `org-table-move-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15471 `org-move-item-up', depending on context. See the individual commands
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15472 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15473 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15474 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15475 ((org-at-table-p) (org-call-with-arg 'org-table-move-row 'up))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15476 ((org-on-heading-p) (call-interactively 'org-move-subtree-up))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15477 ((org-at-item-p) (call-interactively 'org-move-item-up))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15478 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15479
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15480 (defun org-metadown (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15481 "Move subtree down or move table row down.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15482 Calls `org-move-subtree-down' or `org-table-move-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15483 `org-move-item-down', depending on context. See the individual
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15484 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15485 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15486 (cond
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15487 ((org-at-table-p) (call-interactively 'org-table-move-row))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15488 ((org-on-heading-p) (call-interactively 'org-move-subtree-down))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15489 ((org-at-item-p) (call-interactively 'org-move-item-down))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15490 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15491
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15492 (defun org-shiftup (&optional arg)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15493 "Increase item in timestamp or increase priority of current headline.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15494 Calls `org-timestamp-up' or `org-priority-up', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15495 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15496 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15497 (cond
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
15498 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15499 ((org-on-heading-p) (call-interactively 'org-priority-up))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15500 ((org-at-item-p) (call-interactively 'org-previous-item))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15501 (t (call-interactively 'org-beginning-of-item) (beginning-of-line 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15502
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15503 (defun org-shiftdown (&optional arg)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15504 "Decrease item in timestamp or decrease priority of current headline.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15505 Calls `org-timestamp-down' or `org-priority-down', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15506 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15507 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15508 (cond
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
15509 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15510 ((org-on-heading-p) (call-interactively 'org-priority-down))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15511 (t (call-interactively 'org-next-item))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15512
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15513 (defun org-shiftright ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15514 "Next TODO keyword or timestamp one day later, depending on context."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15515 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15516 (cond
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
15517 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15518 ((org-on-heading-p) (org-call-with-arg 'org-todo 'right))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15519 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15520
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15521 (defun org-shiftleft ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15522 "Previous TODO keyword or timestamp one day earlier, depending on context."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15523 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15524 (cond
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
15525 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15526 ((org-on-heading-p) (org-call-with-arg 'org-todo 'left))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15527 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15528
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15529 (defun org-copy-special ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15530 "Copy region in table or copy current subtree.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15531 Calls `org-table-copy' or `org-copy-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15532 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15533 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
15534 (call-interactively
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15535 (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15536
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15537 (defun org-cut-special ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15538 "Cut region in table or cut current subtree.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15539 Calls `org-table-copy' or `org-cut-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15540 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15541 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15542 (call-interactively
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15543 (if (org-at-table-p) 'org-table-cut-region 'org-cut-subtree)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15544
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15545 (defun org-paste-special (arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15546 "Paste rectangular region into table, or past subtree relative to level.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15547 Calls `org-table-paste-rectangle' or `org-paste-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15548 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15549 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15550 (if (org-at-table-p)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15551 (org-table-paste-rectangle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15552 (org-paste-subtree arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15553
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15554 (defun org-ctrl-c-ctrl-c (&optional arg)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15555 "Set tags in headline, or update according to changed information at point.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15556
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15557 This command does many different things, depending on context:
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15558
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15559 - If the cursor is in a headline, prompt for tags and insert them
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15560 into the current line, aligned to `org-tags-column'. When called
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15561 with prefix arg, realign all tags in the current buffer.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15562
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15563 - If the cursor is in one of the special #+KEYWORD lines, this
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15564 triggers scanning the buffer for these lines and updating the
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15565 information.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15566
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15567 - If the cursor is inside a table, realign the table. This command
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15568 works even if the automatic table editor has been turned off.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15569
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15570 - If the cursor is on a #+TBLFM line, re-apply the formulas to
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15571 the entire table.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15572
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15573 - If the cursor is inside a table created by the table.el package,
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
15574 activate that table.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15575
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15576 - If the current buffer is a remember buffer, close note and file it.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15577 with a prefix argument, file it without further interaction to the default
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15578 location.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15579
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15580 - If the cursor is on a <<<target>>>, update radio targets and corresponding
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15581 links in this buffer.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15582
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15583 - If the cursor is on a numbered item in a plain list, renumber the
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
15584 ordered list."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15585 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15586 (let ((org-enable-table-editor t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15587 (cond
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15588 ((or org-clock-overlays org-occur-highlights
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15589 org-latex-fragment-image-overlays)
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15590 (org-remove-clock-overlays)
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15591 (org-remove-occur-highlights)
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15592 (org-remove-latex-fragment-image-overlays)
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15593 (message "Temporary highlights/overlays removed from current buffer"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15594 ((and (local-variable-p 'org-finish-function (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15595 (fboundp org-finish-function))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15596 (funcall org-finish-function))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15597 ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15598 ((org-on-heading-p) (call-interactively 'org-set-tags))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15599 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15600 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15601 (beginning-of-line 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15602 (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15603 (call-interactively 'table-recognize-table))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15604 ((org-at-table-p)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15605 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15606 (if arg
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15607 (call-interactively 'org-table-recalculate)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15608 (org-table-maybe-recalculate-line))
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15609 (call-interactively 'org-table-align))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15610 ((org-at-item-checkbox-p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15611 (call-interactively 'org-toggle-checkbox))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15612 ((org-at-item-p)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15613 (call-interactively 'org-renumber-ordered-list))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15614 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15615 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15616 ((equal (match-string 1) "TBLFM")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15617 ;; Recalculate the table before this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15618 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15619 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15620 (skip-chars-backward " \r\n\t")
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15621 (if (org-at-table-p)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15622 (org-call-with-arg 'org-table-recalculate t))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15623 (t
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15624 (call-interactively 'org-mode-restart))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
15625 (t (error "C-c C-c can do nothing useful at this location.")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15626
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15627 (defun org-mode-restart ()
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15628 "Restart Org-mode, to scan again for special lines.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15629 Also updates the keyword regular expressions."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15630 (interactive)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15631 (let ((org-inhibit-startup t)) (org-mode))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15632 (message "Org-mode restarted to refresh keyword and special line setup"))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15633
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15634 (defun org-return ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15635 "Goto next table row or insert a newline.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15636 Calls `org-table-next-row' or `newline', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15637 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
15638 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15639 (cond
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15640 ((org-at-table-p)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15641 (org-table-justify-field-maybe)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15642 (call-interactively 'org-table-next-row))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15643 (t (newline))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15644
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15645 (defun org-meta-return (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15646 "Insert a new heading or wrap a region in a table.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15647 Calls `org-insert-heading' or `org-table-wrap-region', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15648 See the individual commands for more information."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15649 (interactive "P")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15650 (cond
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
15651 ((org-at-table-p)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15652 (call-interactively 'org-table-wrap-region))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
15653 (t (call-interactively 'org-insert-heading))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15654
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15655 ;;; Menu entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15656
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15657 ;; Define the Org-mode menus
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15658 (easy-menu-define org-tbl-menu org-mode-map "Tbl menu"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15659 '("Tbl"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15660 ["Align" org-ctrl-c-ctrl-c (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15661 ["Next Field" org-cycle (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15662 ["Previous Field" org-shifttab (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15663 ["Next Row" org-return (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15664 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15665 ["Blank Field" org-table-blank-field (org-at-table-p)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15666 ["Edit Field" org-table-edit-field (org-at-table-p)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15667 ["Copy Field from Above" org-table-copy-down (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15668 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15669 ("Column"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15670 ["Move Column Left" org-metaleft (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15671 ["Move Column Right" org-metaright (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15672 ["Delete Column" org-shiftmetaleft (org-at-table-p)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15673 ["Insert Column" org-shiftmetaright (org-at-table-p)]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15674 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15675 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15676 ("Row"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15677 ["Move Row Up" org-metaup (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15678 ["Move Row Down" org-metadown (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15679 ["Delete Row" org-shiftmetaup (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15680 ["Insert Row" org-shiftmetadown (org-at-table-p)]
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
15681 ["Sort lines in region" org-table-sort-lines (org-at-table-p)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15682 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15683 ["Insert Hline" org-table-insert-hline (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15684 ("Rectangle"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15685 ["Copy Rectangle" org-copy-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15686 ["Cut Rectangle" org-cut-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15687 ["Paste Rectangle" org-paste-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15688 ["Fill Rectangle" org-table-wrap-region (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15689 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15690 ("Calculate"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15691 ["Set Column Formula" org-table-eval-formula (org-at-table-p)]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15692 ["Set Named Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15693 ["Edit Formulas" org-table-edit-formulas (org-at-table-p)]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15694 "--"
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15695 ["Recalculate line" org-table-recalculate (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15696 ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15697 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)]
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
15698 "--"
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
15699 ["Sum Column/Rectangle" org-table-sum
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15700 (or (org-at-table-p) (org-region-active-p))]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15701 ["Which Column?" org-table-current-column (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15702 ["Debug Formulas"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15703 (setq org-table-formula-debug (not org-table-formula-debug))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15704 :style toggle :selected org-table-formula-debug]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15705 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15706 ["Create" org-table-create (and (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15707 org-enable-table-editor)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15708 ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15709 ["Import from File" org-table-import (not (org-at-table-p))]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15710 ["Export to File" org-table-export (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15711 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15712 ["Create/Convert from/to table.el" org-table-create-with-table.el t]))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
15713
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15714 (easy-menu-define org-org-menu org-mode-map "Org menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15715 '("Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15716 ["Cycle Visibility" org-cycle (or (bobp) (outline-on-heading-p))]
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15717 ["Cycle Global Visibility" org-shifttab (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15718 ["Sparse Tree" org-occur t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15719 ["Show All" show-all t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15720 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15721 ["New Heading" org-insert-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15722 ("Navigate Headings"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15723 ["Up" outline-up-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15724 ["Next" outline-next-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15725 ["Previous" outline-previous-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15726 ["Next Same Level" outline-forward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15727 ["Previous Same Level" outline-backward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15728 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15729 ["Jump" org-goto t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15730 ("Edit Structure"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15731 ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15732 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15733 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15734 ["Copy Subtree" org-copy-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15735 ["Cut Subtree" org-cut-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15736 ["Paste Subtree" org-paste-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15737 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15738 ["Promote Heading" org-metaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15739 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15740 ["Demote Heading" org-metaright (not (org-at-table-p))]
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
15741 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
15742 "--"
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
15743 ["Convert to odd levels" org-convert-to-odd-levels t]
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
15744 ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15745 ("Archive"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15746 ["Toggle ARCHIVE tag" org-toggle-archive-tag t]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15747 ["Check and Tag Children" (org-toggle-archive-tag (4))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15748 :active t :keys "C-u C-c C-x C-a"]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15749 ["Sparse trees open ARCHIVE trees"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15750 (setq org-sparse-tree-open-archived-trees
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15751 (not org-sparse-tree-open-archived-trees))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15752 :style toggle :selected org-sparse-tree-open-archived-trees]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15753 ["Cycling opens ARCHIVE trees"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15754 (setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15755 :style toggle :selected org-cycle-open-archived-trees]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15756 ["Agenda includes ARCHIVE trees"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15757 (setq org-agenda-skip-archived-trees (not org-agenda-skip-archived-trees))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15758 :style toggle :selected (not org-agenda-skip-archived-trees)]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15759 "--"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15760 ["Move Subtree to Archive" org-archive-subtree t]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15761 ["Check and Move Children" (org-archive-subtree '(4))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15762 :active t :keys "C-u C-c $"])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15763 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15764 ("TODO Lists"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15765 ["TODO/DONE/-" org-todo t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15766 ["Show TODO Tree" org-show-todo-tree t]
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
15767 ["Global TODO list" org-todo-list t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15768 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15769 ["Set Priority" org-priority t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15770 ["Priority Up" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15771 ["Priority Down" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15772 ("Dates and Scheduling"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15773 ["Timestamp" org-time-stamp t]
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15774 ["Timestamp (inactive)" org-time-stamp-inactive t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15775 ("Change Date"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15776 ["1 Day Later" org-timestamp-up-day t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15777 ["1 Day Earlier" org-timestamp-down-day t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15778 ["1 ... Later" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15779 ["1 ... Earlier" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15780 ["Compute Time Range" org-evaluate-time-range t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15781 ["Schedule Item" org-schedule t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15782 ["Deadline" org-deadline t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15783 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15784 ["Goto Calendar" org-goto-calendar t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15785 ["Date from Calendar" org-date-from-calendar t])
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15786 ("Logging work"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15787 ["Clock in" org-clock-in t]
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15788 ["Clock out" org-clock-out t]
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15789 ["Clock cancel" org-clock-cancel t]
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15790 ["Display times" org-clock-display t]
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
15791 ["Create clock table" org-clock-report t]
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15792 "--"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15793 ["Record DONE time"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15794 (progn (setq org-log-done (not org-log-done))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15795 (message "Switching to %s will %s record a timestamp"
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15796 org-done-string
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15797 (if org-log-done "automatically" "not")))
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15798 :style toggle :selected org-log-done])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15799 "--"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
15800 ["Agenda Command" org-agenda t]
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
15801 ("File List for Agenda")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
15802 ("Special views current file"
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
15803 ["TODO Tree" org-show-todo-tree t]
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
15804 ["Check Deadlines" org-check-deadlines t]
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
15805 ["Timeline" org-timeline t]
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
15806 ["Tags Tree" org-tags-sparse-tree t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15807 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15808 ("Hyperlinks"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
15809 ["Store Link (Global)" org-store-link t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15810 ["Insert Link" org-insert-link t]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15811 ["Follow Link" org-open-at-point t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15812 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15813 ["Descriptive Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15814 (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15815 :style radio :selected (member '(org-link) buffer-invisibility-spec)]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15816 ["Literal Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15817 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15818 (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15819 :style radio :selected (not (member '(org-link) buffer-invisibility-spec))]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15820 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15821 ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15822 (save-excursion (goto-char (point-min))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15823 (re-search-forward "<[a-z]+:" nil t))])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15824 "--"
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
15825 ["Export/Publish" org-export t]
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15826 ("LaTeX"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15827 ["Org CDLaTeX mode" org-cdlatex-mode :style toggle
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15828 :selected org-cdlatex-mode]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15829 ["Insert Environment" cdlatex-environment (fboundp 'cdlatex-environment)]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15830 ["Insert math symbol" cdlatex-math-symbol (fboundp 'cdlatex-math-symbol)]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15831 ["Modify math symbol" org-cdlatex-math-modify
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15832 (org-inside-LaTeX-fragment-p)]
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15833 ["Export LaTeX fragments as images"
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15834 (setq org-export-with-LaTeX-fragments (not org-export-with-LaTeX-fragments))
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
15835 :style toggle :selected org-export-with-LaTeX-fragments])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15836 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15837 ("Documentation"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15838 ["Show Version" org-version t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15839 ["Info Documentation" org-info t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15840 ("Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15841 ["Browse Org Group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15842 "--"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15843 ["Expand This Menu" org-create-customize-menu
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15844 (fboundp 'customize-menu-create)])
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15845 "--"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
15846 ["Refresh setup" org-mode-restart t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15847 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15848
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15849 (defun org-info (&optional node)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15850 "Read documentation for Org-mode in the info system.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15851 With optional NODE, go directly to that node."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15852 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15853 (require 'info)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15854 (Info-goto-node (format "(org)%s" (or node ""))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15855
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15856 (defun org-install-agenda-files-menu ()
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15857 (let ((bl (buffer-list)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15858 (save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15859 (while bl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15860 (set-buffer (pop bl))
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
15861 (if (org-mode-p) (setq bl nil)))
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
15862 (when (org-mode-p)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15863 (easy-menu-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15864 '("Org") "File List for Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15865 (append
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15866 (list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15867 ["Edit File List" (org-edit-agenda-file-list) t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15868 ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15869 ["Remove Current File from List" org-remove-file t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15870 ["Cycle through agenda files" org-cycle-agenda-files t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15871 "--")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
15872 (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15873
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15874 ;;; Documentation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15875
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15876 (defun org-customize ()
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
15877 "Call the customize function with org as argument."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15878 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15879 (customize-browse 'org))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15880
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15881 (defun org-create-customize-menu ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15882 "Create a full customization menu for Org-mode, insert it into the menu."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15883 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15884 (if (fboundp 'customize-menu-create)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15885 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15886 (easy-menu-change
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15887 '("Org") "Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15888 `(["Browse Org group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15889 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15890 ,(customize-menu-create 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15891 ["Set" Custom-set t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15892 ["Save" Custom-save t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15893 ["Reset to Current" Custom-reset-current t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15894 ["Reset to Saved" Custom-reset-saved t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15895 ["Reset to Standard Settings" Custom-reset-standard t]))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15896 (message "\"Org\"-menu now contains full customization menu"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15897 (error "Cannot expand menu (outdated version of cus-edit.el)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15898
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15899 ;;; Miscellaneous stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15900
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15901 (defun org-context ()
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15902 "Return a list of contexts of the current cursor position.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15903 If several contexts apply, all are returned.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15904 Each context entry is a list with a symbol naming the context, and
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15905 two positions indicating start and end of the context. Possible
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15906 contexts are:
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15907
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15908 :headline anywhere in a headline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15909 :headline-stars on the leading stars in a headline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15910 :todo-keyword on a TODO keyword (including DONE) in a headline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15911 :tags on the TAGS in a headline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15912 :priority on the priority cookie in a headline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15913 :item on the first line of a plain list item
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15914 :item-bullet on the bullet/number of a plain list item
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15915 :checkbox on the checkbox in a plain list item
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15916 :table in an org-mode table
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15917 :table-special on a special filed in a table
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15918 :table-table in a table.el table
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15919 :link on a hyperline
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15920 :keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15921 :target on a <<target>>
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15922 :radio-target on a <<<radio-target>>>
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15923 :latex-fragment on a LaTeX fragment
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15924 :latex-preview on a LaTeX fragment with overlayed preview image
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15925
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15926 This function expects the position to be visible because it uses font-lock
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15927 faces as a help to recognize the following contexts: :table-special, :link,
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15928 and :keyword."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15929 (let* ((f (get-text-property (point) 'face))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15930 (faces (if (listp f) f (list f)))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15931 (p (point)) clist o)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15932 ;; First the large context
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15933 (cond
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15934 ((org-on-heading-p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15935 (push (list :headline (point-at-bol) (point-at-eol)) clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15936 (when (progn
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15937 (beginning-of-line 1)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15938 (looking-at org-todo-line-tags-regexp))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15939 (push (org-point-in-group p 1 :headline-stars) clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15940 (push (org-point-in-group p 2 :todo-keyword) clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15941 (push (org-point-in-group p 4 :tags) clist))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15942 (goto-char p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15943 (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15944 (if (looking-at "\\[#[A-Z]\\]")
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15945 (push (org-point-in-group p 0 :priority) clist)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15946
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15947 ((org-at-item-p)
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15948 (push (org-point-in-group p 2 :item-bullet) clist)
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15949 (push (list :item (point-at-bol)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15950 (save-excursion (org-end-of-item) (point)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15951 clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15952 (and (org-at-item-checkbox-p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15953 (push (org-point-in-group p 0 :checkbox) clist)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15954
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15955 ((org-at-table-p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15956 (push (list :table (org-table-begin) (org-table-end)) clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15957 (if (memq 'org-formula faces)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15958 (push (list :table-special
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15959 (previous-single-property-change p 'face)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15960 (next-single-property-change p 'face)) clist)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15961 ((org-at-table-p 'any)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15962 (push (list :table-table) clist)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15963 (goto-char p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15964
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15965 ;; Now the small context
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15966 (cond
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15967 ((org-at-timestamp-p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15968 (push (org-point-in-group p 0 :timestamp) clist))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15969 ((memq 'org-link faces)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15970 (push (list :link
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15971 (previous-single-property-change p 'face)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15972 (next-single-property-change p 'face)) clist))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15973 ((memq 'org-special-keyword faces)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15974 (push (list :keyword
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15975 (previous-single-property-change p 'face)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15976 (next-single-property-change p 'face)) clist))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15977 ((org-on-target-p)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15978 (push (org-point-in-group p 0 :target) clist)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15979 (goto-char (1- (match-beginning 0)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15980 (if (looking-at org-radio-target-regexp)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15981 (push (org-point-in-group p 0 :radio-target) clist))
71506
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15982 (goto-char p))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15983 ((setq o (car (delq nil
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15984 (mapcar
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15985 (lambda (x)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15986 (if (memq x org-latex-fragment-image-overlays) x))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15987 (org-overlays-at (point))))))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15988 (push (list :latex-fragment
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15989 (org-overlay-start o) (org-overlay-end o)) clist)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15990 (push (list :latex-preview
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15991 (org-overlay-start o) (org-overlay-end o)) clist))
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15992 ((org-inside-LaTeX-fragment-p)
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15993 ;; FIXME: positions wring.
727524ec34f8 (org-context): New contexts :item-bullet,
Carsten Dominik <dominik@science.uva.nl>
parents: 71449
diff changeset
15994 (push (list :latex-fragment (point) (point)) clist)))
71096
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15995
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15996 (setq clist (nreverse (delq nil clist)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15997 clist))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15998
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
15999 (defun org-point-in-group (point group &optional context)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16000 "Check if POINT is in match-group GROUP.
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16001 If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16002 match. If the match group does ot exist or point is not inside it,
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16003 return nil."
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16004 (and (match-beginning group)
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16005 (>= point (match-beginning group))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16006 (<= point (match-end group))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16007 (if context
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16008 (list context (match-beginning group) (match-end group))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16009 t)))
d26859871d39 (org-agenda-highlight-todo): Make sure regexp
Carsten Dominik <dominik@science.uva.nl>
parents: 70953
diff changeset
16010
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16011 (defun org-move-line-down (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16012 "Move the current line down. With prefix argument, move it past ARG lines."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16013 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16014 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16015 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16016 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16017 (beginning-of-line 2) (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16018 (beginning-of-line (+ 1 arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16019 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16020 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16021 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16022 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16023
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16024 (defun org-move-line-up (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16025 "Move the current line up. With prefix argument, move it past ARG lines."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16026 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16027 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16028 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16029 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16030 (beginning-of-line 2) (setq end (point))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16031 (beginning-of-line (- arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16032 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16033 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16034 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16035 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16036
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16037 ;; Paragraph filling stuff.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16038 ;; We want this to be just right, so use the full arsenal.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16039
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16040 (defun org-set-autofill-regexps ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16041 (interactive)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16042 ;; In the paragraph separator we include headlines, because filling
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16043 ;; text in a line directly attached to a headline would otherwise
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16044 ;; fill the headline as well.
71449
525b50d438b5 (org-cdlatex-mode-map)
Carsten Dominik <dominik@science.uva.nl>
parents: 71384
diff changeset
16045 (set (make-local-variable 'comment-start-skip) "^#+[ \t]*")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16046 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16047 ;; The paragraph starter includes hand-formatted lists.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16048 (set (make-local-variable 'paragraph-start)
71524
d408779d0af3 (org-prepare-agenda-buffers): Use `invisible-OK' argument
Carsten Dominik <dominik@science.uva.nl>
parents: 71506
diff changeset
16049 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16050 ;; Inhibit auto-fill for headers, tables and fixed-width lines.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16051 ;; But only if the user has not turned off tables or fixed-width regions
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16052 (set (make-local-variable 'auto-fill-inhibit-regexp)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16053 (concat "\\*\\|#"
71310
0d8984127630 (org-agenda-mode-map): Add bindings for clocking
Carsten Dominik <dominik@science.uva.nl>
parents: 71244
diff changeset
16054 "\\|[ \t]*" org-keyword-time-regexp
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16055 (if (or org-enable-table-editor org-enable-fixed-width-editor)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16056 (concat
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16057 "\\|[ \t]*["
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16058 (if org-enable-table-editor "|" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16059 (if org-enable-fixed-width-editor ":" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16060 "]"))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16061 ;; We use our own fill-paragraph function, to make sure that tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16062 ;; and fixed-width regions are not wrapped. That function will pass
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16063 ;; through to `fill-paragraph' when appropriate.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16064 (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16065 ;; Adaptive filling: To get full control, first make sure that
70018
513397bbb13c *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70017
diff changeset
16066 ;; `adaptive-fill-regexp' never matches. Then install our own matcher.
70017
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
16067 (set (make-local-variable 'adaptive-fill-regexp) "\000")
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
16068 (set (make-local-variable 'adaptive-fill-function)
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
16069 'org-adaptive-fill-function))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16070
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16071 (defun org-fill-paragraph (&optional justify)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16072 "Re-align a table, pass through to fill-paragraph if no table."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16073 (let ((table-p (org-at-table-p))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16074 (table.el-p (org-at-table.el-p)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16075 (cond ((equal (char-after (point-at-bol)) ?*) t) ; skip headlines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16076 (table.el-p t) ; skip table.el tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16077 (table-p (org-table-align) t) ; align org-mode tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16078 (t nil)))) ; call paragraph-fill
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16079
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16080 ;; For reference, this is the default value of adaptive-fill-regexp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16081 ;; "[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16082
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16083 (defun org-adaptive-fill-function ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16084 "Return a fill prefix for org-mode files.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16085 In particular, this makes sure hanging paragraphs for hand-formatted lists
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16086 work correctly."
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
16087 (if (looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16088 (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
16089
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16090 ;; Functions needed for Emacs/XEmacs region compatibility
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16091
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16092 (defun org-add-hook (hook function &optional append local)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16093 "Add-hook, compatible with both Emacsen."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
16094 (if (and local (featurep 'xemacs))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
16095 (add-local-hook hook function append)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
16096 (add-hook hook function append local)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16097
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16098 (defun org-region-active-p ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16099 "Is `transient-mark-mode' on and the region active?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16100 Works on both Emacs and XEmacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16101 (if org-ignore-region
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16102 nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
16103 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16104 (and zmacs-regions (region-active-p))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16105 (and transient-mark-mode mark-active))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16106
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16107 (defun org-add-to-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16108 "Add elements to `buffer-invisibility-spec'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16109 See documentation for `buffer-invisibility-spec' for the kind of elements
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16110 that can be added."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16111 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16112 ((fboundp 'add-to-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16113 (add-to-invisibility-spec arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16114 ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16115 (setq buffer-invisibility-spec (list arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16116 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16117 (setq buffer-invisibility-spec
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16118 (cons arg buffer-invisibility-spec)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16119
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16120 (defun org-remove-from-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16121 "Remove elements from `buffer-invisibility-spec'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16122 (if (fboundp 'remove-from-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16123 (remove-from-invisibility-spec arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16124 (if (consp buffer-invisibility-spec)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16125 (setq buffer-invisibility-spec
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16126 (delete arg buffer-invisibility-spec)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16127
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16128 (defun org-in-invisibility-spec-p (arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
16129 "Is ARG a member of `buffer-invisibility-spec'?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16130 (if (consp buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16131 (member arg buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16132 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16133
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16134 (defun org-image-file-name-regexp ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16135 "Return regexp matching the file names of images."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16136 (if (fboundp 'image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16137 (image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16138 (let ((image-file-name-extensions
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16139 '("png" "jpeg" "jpg" "gif" "tiff" "tif"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16140 "xbm" "xpm" "pbm" "pgm" "ppm")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16141 (concat "\\."
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16142 (regexp-opt (nconc (mapcar 'upcase
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16143 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16144 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16145 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16146 "\\'"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16147
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16148 ;; Functions needed for compatibility with old outline.el.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16149
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16150 ;; Programming for the old outline.el (that uses selective display
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16151 ;; instead of `invisible' text properties) is a nightmare, mostly
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16152 ;; because regular expressions can no longer be anchored at
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16153 ;; beginning/end of line. Therefore a number of function need special
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16154 ;; treatment when the old outline.el is being used.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16155
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16156 ;; The following functions capture almost the entire compatibility code
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16157 ;; between the different versions of outline-mode. The only other
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16158 ;; places where this is important are the font-lock-keywords, and in
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16159 ;; `org-export-visible'. Search for `org-noutline-p' to find them.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16160
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16161 ;; C-a should go to the beginning of a *visible* line, also in the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16162 ;; new outline.el. I guess this should be patched into Emacs?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16163 (defun org-beginning-of-line ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16164 "Go to the beginning of the current line. If that is invisible, continue
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16165 to a visible line beginning. This makes the function of C-a more intuitive."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16166 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16167 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16168 (if (bobp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16169 nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16170 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16171 (if (org-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16172 (while (and (not (bobp)) (org-invisible-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16173 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16174 (beginning-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16175 (forward-char 1))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16176
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16177 (when org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16178 (define-key org-mode-map "\C-a" 'org-beginning-of-line))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16179
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16180 (defun org-invisible-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16181 "Check if point is at a character currently not visible."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16182 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16183 ;; Early versions of noutline don't have `outline-invisible-p'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16184 (if (fboundp 'outline-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16185 (outline-invisible-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16186 (get-char-property (point) 'invisible))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16187 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16188 (skip-chars-backward "^\r\n")
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
16189 (equal (char-before) ?\r))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16190
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16191 (defun org-invisible-p2 ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16192 "Check if point is at a character currently not visible."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16193 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16194 (if org-noutline-p
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16195 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16196 (if (and (eolp) (not (bobp))) (backward-char 1))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16197 ;; Early versions of noutline don't have `outline-invisible-p'.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16198 (if (fboundp 'outline-invisible-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16199 (outline-invisible-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16200 (get-char-property (point) 'invisible)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16201 (skip-chars-backward "^\r\n")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16202 (equal (char-before) ?\r))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16203
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16204 (defun org-back-to-heading (&optional invisible-ok)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16205 "Move to previous heading line, or beg of this line if it's a heading.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16206 Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16207 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16208 (outline-back-to-heading invisible-ok)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16209 (if (and (or (bobp) (memq (char-before) '(?\n ?\r)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16210 (looking-at outline-regexp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16211 t
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
16212 (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16213 outline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16214 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16215 (if invisible-ok
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16216 (progn (goto-char (or (match-end 1) (match-beginning 0)))
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16217 (looking-at outline-regexp)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16218 (error "Before first heading")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16219
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16220 (defun org-on-heading-p (&optional invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16221 "Return t if point is on a (visible) heading line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16222 If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16223 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16224 (outline-on-heading-p 'invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16225 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16226 (skip-chars-backward "^\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16227 (and (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16228 (or invisible-ok
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16229 (bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16230 (equal (char-before) ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16231
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16232 (defun org-on-target-p ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16233 (let ((pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16234 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16235 (skip-chars-forward "<")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16236 (and (re-search-backward "<<" nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
16237 (or (looking-at org-radio-target-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
16238 (looking-at org-target-regexp))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16239 (<= (match-beginning 0) pos)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
16240 (>= (1+ (match-end 0)) pos)))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
16241
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16242 (defun org-up-heading-all (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16243 "Move to the heading line of which the present line is a subheading.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16244 This function considers both visible and invisible heading lines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16245 With argument, move up ARG levels."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16246 (if org-noutline-p
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
16247 (if (fboundp 'outline-up-heading-all)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16248 (outline-up-heading-all arg) ; emacs 21 version of outline.el
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16249 (outline-up-heading arg t)) ; emacs 22 version of outline.el
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16250 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16251 (looking-at outline-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16252 (if (<= (- (match-end 0) (match-beginning 0)) arg)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16253 (error "Cannot move up %d levels" arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16254 (re-search-backward
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16255 (concat "[\n\r]" (regexp-quote
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16256 (make-string (- (match-end 0) (match-beginning 0) arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16257 ?*))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16258 "[^*]"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16259 (forward-char 1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16260
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16261 (defun org-show-hidden-entry ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16262 "Show an entry where even the heading is hidden."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16263 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16264 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16265 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16266 (org-back-to-heading t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16267 (org-flag-heading nil)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16268 (org-show-entry)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16269
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16270 (defun org-check-occur-regexp (regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16271 "If REGEXP starts with \"^\", modify it to check for \\r as well.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16272 Of course, only for the old outline mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16273 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16274 regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16275 (if (string-match "^\\^" regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16276 (concat "[\n\r]" (substring regexp 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16277 regexp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16278
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16279 (defun org-flag-heading (flag &optional entry)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
16280 "Flag the current heading. FLAG non-nil means make invisible.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16281 When ENTRY is non-nil, show the entire entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16282 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16283 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16284 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16285 ;; Make the current headline visible
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16286 (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16287 ;; Check if we should show the entire entry
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16288 (if entry
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16289 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16290 (org-show-entry)
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16291 (save-excursion
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16292 (and (outline-next-heading)
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16293 (org-flag-heading nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16294 (outline-flag-region (max 1 (1- (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16295 (save-excursion (outline-end-of-heading) (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16296 (if org-noutline-p
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16297 flag
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
16298 (if flag ?\r ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16299
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16300 (defun org-end-of-subtree (&optional invisible-OK)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16301 ;; This is an exact copy of the original function, but it uses
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16302 ;; `org-back-to-heading', to make it work also in invisible
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16303 ;; trees. And is uses an invisible-OK argument.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16304 ;; Under Emacs this is not needed, but the old outline.el needs this fix.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16305 (org-back-to-heading invisible-OK)
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16306 (let ((first t)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16307 (level (funcall outline-level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16308 (while (and (not (eobp))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16309 (or first (> (funcall outline-level) level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16310 (setq first nil)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16311 (outline-next-heading))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16312 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16313 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16314 ;; Go to end of line before heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16315 (forward-char -1)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16316 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16317 ;; leave blank line before heading
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
16318 (forward-char -1)))))
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
16319 (point))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
16320
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16321 (defun org-show-subtree ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16322 "Show everything after this heading at deeper levels."
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
16323 (outline-flag-region
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
16324 (point)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16325 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16326 (outline-end-of-subtree) (outline-next-heading) (point))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16327 (if org-noutline-p nil ?\n)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16328
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16329 (defun org-show-entry ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16330 "Show the body directly following this heading.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16331 Show the heading too, if it is currently invisible."
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16332 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16333 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16334 (org-back-to-heading t)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
16335 (outline-flag-region
70866
7d0efe895341 (org-open-at-point): Use renamed variable
Carsten Dominik <dominik@science.uva.nl>
parents: 70585
diff changeset
16336 (max 1 (1- (point)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16337 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16338 (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16339 (or (match-beginning 1) (point-max)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16340 (if org-noutline-p nil ?\n))))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
16341
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16342 (defun org-make-options-regexp (kwds)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16343 "Make a regular expression for keyword lines."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16344 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16345 (if org-noutline-p "^" "[\n\r]")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16346 "#?[ \t]*\\+\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16347 (mapconcat 'regexp-quote kwds "\\|")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16348 "\\):[ \t]*"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16349 (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16350
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16351 ;; Make `bookmark-jump' show the jump location if it was hidden.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16352 (eval-after-load "bookmark"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16353 '(if (boundp 'bookmark-after-jump-hook)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16354 ;; We can use the hook
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16355 (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16356 ;; Hook not available, use advice
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16357 (defadvice bookmark-jump (after org-make-visible activate)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16358 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16359 (org-bookmark-jump-unhide))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16360
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16361 (defun org-bookmark-jump-unhide ()
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16362 "Unhide the current position, to show the bookmark location."
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
16363 (and (org-mode-p)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16364 (or (org-invisible-p)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16365 (save-excursion (goto-char (max (point-min) (1- (point))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16366 (org-invisible-p)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
16367 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16368
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
16369 ;;; Experimental code
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
16370
71563
fca8faa8f94c (org-mode): Removed no invalid settings for calc embedded
Carsten Dominik <dominik@science.uva.nl>
parents: 71524
diff changeset
16371
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16372 ;;; Finish up
71384
9853142939b3 Require noutline, also on XEmacs.
Carsten Dominik <dominik@science.uva.nl>
parents: 71310
diff changeset
16373
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16374 (provide 'org)
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16375
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16376 (run-hooks 'org-load-hook)
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16377
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16378 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
16379 ;;; org.el ends here